0% found this document useful (0 votes)
44 views2 pages

Parshing App

The PHP code defines functions for making HTTP requests using cURL, including functions for GET and POST requests. It also includes functions for saving and loading data from a JSON file to store credentials like the user agent and cookie between runs.

Uploaded by

Farheen Zaidi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views2 pages

Parshing App

The PHP code defines functions for making HTTP requests using cURL, including functions for GET and POST requests. It also includes functions for saving and loading data from a JSON file to store credentials like the user agent and cookie between runs.

Uploaded by

Farheen Zaidi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<?

php

function curl($url, $post = 0, $httpheader = 0, $proxy = 0){ // url, postdata, http


headers, proxy, uagent
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_COOKIE,TRUE);
/* curl_setopt($ch, CURLOPT_COOKIEFILE,"cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR,"cookie.txt"); */
if($post){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if($httpheader){
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
}
if($proxy){
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
// curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
}
curl_setopt($ch, CURLOPT_HEADER, true);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch);
if(!$httpcode) return "Curl Error : ".curl_error($ch); else{
$header = substr($response, 0, curl_getinfo($ch,
CURLINFO_HEADER_SIZE));
$body = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
curl_close($ch);
return array($header, $body);
}
}

function get($url,$host){
return curl($url,'',head($host))[1];
}

function post($url,$data,$host){
return curl($url,$data,head($host))[1];
}

function head($host){
$user=json_decode(file_get_contents("data.json"),true)["User"];
$cookie=json_decode(file_get_contents("data.json"),true)["Cookie"];
$h[]="Host: $host";
$h[]="content-type: application/x-www-form-urlencoded";
$h[]="user-agent: $user";
$h[]="cookie: $cookie";
return $h;
}

if(!file_exists("data.json")){
while("true"){
system("clear");
//ban();
$api["Cookie"]=readline("\033[1;97mInput Your Cookie : \033[1;92m");
if($api["Cookie"]!=""){
break;
}
}
while("true"){
system("clear");
//ban();
$api["User"]=readline("\033[1;97mInput Your User-agent : \033[1;92m");
if($api["User"]!=""){
break;
}
}

save("data.json",$api);
//$a=next($ran);
}

function save($data,$data_post){
if(!file_get_contents($data)){
file_put_contents($data,"[]");}
$json=json_decode(file_get_contents($data),1);
$arr=array_merge($json,$data_post);
file_put_contents($data,json_encode($arr,JSON_PRETTY_PRINT));
}

function timer($t){
$timr=time()+$t;
while(true):
echo "\r \r";
$res=$timr-time();
if($res < 1){break;}
if($res==$res){
// $str= str_repeat("\033[1;92m◼",$res)." \r";
}
echo " \033[1;97mPlease Wait \033[1;91m".date('i:s',$res)." ";
sleep(1);
endwhile;
}

function slow($str,$t){
$arr = str_split($str);
foreach ($arr as $az){
echo $az;
usleep($t);
}
}

You might also like