Tema: Re: duomenu ripinimas naudojantis php
Autorius: isolated
Data: 2009-10-31 20:05:51
kas blogiausia ziuriu anam gale viskas jquery sudeta, ir net ripinant login 
puslapi gryba supjauna...
negi teks lokaliai pasikurt kazka testavimams... :D

"Nerijus T" <news@upe.lt> wrote in message 
news:hchtp8$eoe$1@trimpas.omnitel.net...
> cia kazkodel is vieno interneto tekejo negalejau pasijungti i 8080 porta 
> :)
> <?
> // Nerijus http://upe.lt/
>
> $url = 'https://aguona.serveriai.lt:8080/';
> $user = urlencode($_REQUEST['user']);
> $pass = urlencode($_REQUEST['pass']);
> $dom = urlencode($_REQUEST['dom']);
> $pp='referer=https://aguona.serveriai.lt:8080/&submit=Login&username='.$user.'&password='.$pass;
> // disguises the curl using fake headers and a fake user agent.
> function disguise_curl($url,$pp,$dom)
> {
> $gacookie="/home/zzz/cookie.txt";
> @touch($gacookie);
> @chmod($gacookie,0666);
>
>  $curl0 = curl_init();
>
>  // Setup headers - I used the same headers from Firefox version 2.0.0.6
>  // below was split up because php.net said the line was too long. :/
>  $header[0] = "Accept: image/gif, image/x-xbitmap, image/jpeg, 
> image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, 
> application/vnd.ms-powerpoint, application/msword, */*";
>  $header[] = "Connection: keep-alive";
>  $header[] = "Accept-Language: en,lt;q=0.8,ru;q=0.5,en-us;q=0.3";
>
>  curl_setopt($curl0, CURLOPT_URL, $url);
>  curl_setopt($curl0, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 
> 6.0; Windows NT 5.1; SV1; InfoPath.1, PHP)');
>  curl_setopt($curl0, CURLOPT_HTTPHEADER, $header);
>  curl_setopt($curl0, CURLOPT_REFERER, 
> 'https://aguona.serveriai.lt:8080/');
>  curl_setopt($curl0, CURLOPT_ENCODING, 'gzip,deflate');
>  curl_setopt($curl0, CURLOPT_AUTOREFERER, true);
>  curl_setopt($curl0, CURLOPT_RETURNTRANSFER, 1);
>  curl_setopt($curl0, CURLOPT_TIMEOUT, 50);
>  curl_setopt($curl0, CURLOPT_SSL_VERIFYPEER, false);
>  curl_setopt ($curl0, CURLOPT_COOKIEFILE, $gacookie);
>  curl_setopt ($curl0, CURLOPT_COOKIEJAR, $gacookie);
>
>  $html = curl_exec($curl0); // execute the curl command
>  curl_close($curl0); // close the connection
>
>  $curl = curl_init();
>
> $url1= $url.'CMD_LOGIN';
> curl_setopt($curl, CURLOPT_URL, $url1);
>  curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; 
> Windows NT 5.1; SV1; InfoPath.1, PHP)');
>  curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
>  curl_setopt($curl, CURLOPT_REFERER, 'https://aguona.serveriai.lt:8080/');
>  curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
>  curl_setopt($curl, CURLOPT_AUTOREFERER, true);
>  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
>  curl_setopt($curl, CURLOPT_TIMEOUT, 50);
>  curl_setopt($curl, CURLOPT_POST, 1);
>  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
>  curl_setopt($curl, CURLOPT_POSTFIELDS, $pp);
>  curl_setopt ($curl, CURLOPT_COOKIEFILE, $gacookie);
>  curl_setopt ($curl, CURLOPT_COOKIEJAR, $gacookie);
> curl_setopt($curl, CURLINFO_HEADER_OUT, true);
> curl_setopt($curl, CURLOPT_VERBOSE, 1);
> $fh = fopen('/home/upe/data/logs/curl-response-headers.txt','w') or 
> die($php_errormsg);
> curl_setopt($curl, CURLOPT_WRITEHEADER, $fh);
>
>  $html = curl_exec($curl); // execute the curl command
> //var_dump(curl_getinfo($curl,CURLINFO_HEADER_OUT));
>  curl_close($curl); // close the connection
>
> $url2= $url.'CMD_SHOW_LOG?domain='.$dom.'&type=log';
>  $curl1 = curl_init();
>  curl_setopt($curl1, CURLOPT_URL, $url2);
>  curl_setopt($curl1, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 
> 6.0; Windows NT 5.1; SV1; InfoPath.1, PHP)');
>  curl_setopt($curl1, CURLOPT_HTTPHEADER, $header);
>  curl_setopt($curl1, CURLOPT_REFERER, 
> 'https://aguona.serveriai.lt:8080/');
>  curl_setopt($curl1, CURLOPT_ENCODING, 'gzip,deflate');
>  curl_setopt($curl1, CURLOPT_AUTOREFERER, true);
>  curl_setopt($curl1, CURLOPT_RETURNTRANSFER, 1);
>  curl_setopt($curl1, CURLOPT_TIMEOUT, 50);
>  curl_setopt($curl1, CURLOPT_SSL_VERIFYPEER, false);
>  curl_setopt ($curl1, CURLOPT_COOKIEFILE, $gacookie);
>  curl_setopt ($curl1, CURLOPT_COOKIEJAR, $gacookie);
>
>  $html = curl_exec($curl1); // execute the curl command
>  curl_close($curl1); // close the connection
>
>  return $html; // and finally, return $html
> }
>
> // uses the function and displays the text off the website
> $text = disguise_curl($url,$pp,$dom);
> echo $text;
> ?>
>
>