Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function curl($url,$post=""){
- //echo $url;
- $c=curl_init();
- curl_setopt($c, CURLOPT_URL, $url);
- curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0');
- curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($c, CURLOPT_TIMEOUT, 35);
- curl_setopt($c, CURLOPT_COOKIEJAR, './cookies/test.txt');
- curl_setopt($c, CURLOPT_COOKIEFILE, './cookies/test.txt');
- //curl_setopt($c, CURLOPT_PROXY, 'socks5://localhost:9999');
- if($post!=""){
- curl_setopt($c, CURLOPT_POST, 1);
- curl_setopt($c, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
- $rez=curl_exec($c);
- return $rez;
- }
- $rez=curl('https://www.whoscored.com/Teams/14');
- file_put_contents('page_1.html', $rez);
- preg_match_all("/var.*=\"\";var .*=\"(.*?)\"/", $rez, $m); //Cautam carnatu` de hex
- $unhexed = pack('H*', $m[1][1]); //unhex
- echo $unhexed;//debug
- preg_match_all('/"GET","\/_Incapsula_Resource\?SWHANEDL=(.*?)"/', $unhexed, $m); //Cautam codul acela
- var_dump($m); //debug
- $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
- file_put_contents('page_2.html', $rez);
- $rez=curl('https://www.whoscored.com/Teams/14'); //pagina initiala
- file_put_contents('paginafinala.html', $rez);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement