SHARE
TWEET

Untitled

a guest May 29th, 2016 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <?php
  3.  
  4. function curl($url,$post=""){
  5.  
  6.     //echo $url;
  7.     $c=curl_init();
  8.     curl_setopt($c, CURLOPT_URL, $url);
  9.     curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0');
  10.     curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
  11.     curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
  12.     curl_setopt($c, CURLOPT_TIMEOUT, 35);
  13.     curl_setopt($c, CURLOPT_COOKIEJAR, './cookies/test.txt');
  14.     curl_setopt($c, CURLOPT_COOKIEFILE, './cookies/test.txt');
  15.     //curl_setopt($c, CURLOPT_PROXY, 'socks5://localhost:9999');
  16.     if($post!=""){
  17.         curl_setopt($c, CURLOPT_POST, 1);
  18.         curl_setopt($c, CURLOPT_POSTFIELDS, $post);
  19.     }
  20.     curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  21.     $rez=curl_exec($c);
  22.  
  23.     return $rez;
  24.  
  25. }
  26.  
  27. $rez=curl('https://www.whoscored.com/Teams/14');
  28. file_put_contents('page_1.html', $rez);
  29. preg_match_all("/var.*=\"\";var .*=\"(.*?)\"/", $rez, $m); //Cautam carnatu` de hex
  30. $unhexed = pack('H*', $m[1][1]); //unhex
  31.  
  32. echo $unhexed;//debug
  33. preg_match_all('/"GET","\/_Incapsula_Resource\?SWHANEDL=(.*?)"/', $unhexed, $m); //Cautam codul acela
  34. var_dump($m); //debug
  35.  
  36. $rez=curl('https://www.whoscored.com/_Incapsula_Resource?SWHANEDL='.$m[1][0]); //Facem un request cu acel cod dupa acest request ar trebui sa avem cookie-urile potrivite
  37. file_put_contents('page_2.html', $rez);
  38.  
  39. $rez=curl('https://www.whoscored.com/Teams/14'); //pagina initiala
  40.  
  41. file_put_contents('paginafinala.html', $rez);
  42. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top