Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Integral functions
- function GetProxy()
- {
- $proxy['user'] = 'egyuuyke-dest';
- $proxy['password'] = 'uih8y6ro8r6p';
- $proxy['ip'] = '209.127.191.180';
- $proxy['port'] = '9279';
- $proxy['auth'] = CURLPROXY_HTTP;
- return $proxy;
- }
- function GetUseragent()
- {
- return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36";
- }
- function GetHeaders()
- {
- srand();
- $headers = array(
- 'Connection: keep-alive',
- 'Pragma: no-cache',
- 'Cache-Control: no-cache',
- 'Accept: application/json, text/javascript, */*; q=0.01',
- 'DNT: 1',
- 'X-Requested-With: XMLHttpRequest',
- 'User-Agent: '.GetUseragent(),
- 'Referer: http://vixcentral.com/',
- //'Accept-Encoding: gzip, deflate',
- 'Accept-Language: en-US,en;q=0.9'
- );
- return $headers;
- }
- //Returns a full HTML page
- //responsecode if true, just returns whether its a 404 or something
- function Scrape_GetURLContent($url, $usecookies = false, $useproxy = false, $responsecode = false)
- {
- $ch = @curl_init(); //Init
- if($ch === false){
- return 0; //Failed somehow... uhh
- }
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_REFERER, "http://vixcentral.com/");
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- //curl_setopt($ch, CURLOPT_USERAGENT, GetUseragent());
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
- curl_setopt($ch, CURLOPT_MAXREDIRS, 0); //10 directs maximum
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_HEADER, $responsecode);
- curl_setopt($ch, CURLOPT_NOBODY, $responsecode);
- curl_setopt($ch, CURLOPT_HTTPHEADER, GetHeaders());
- //Enable cookies?
- if($usecookies)
- {
- $cookie = dirname(__FILE__) . "cookies.txt";
- curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); // have tried with just the jar, and just the file and both
- }else
- {
- curl_setopt($ch, CURLOPT_COOKIESESSION, FALSE);
- }
- //Use a proxy?
- if($useproxy)
- {
- $proxy = GetProxy();
- @curl_setopt($ch, CURLOPT_PROXY, $proxy['ip'] . ':' . $proxy['port']);
- @curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy['user'] . ':' . $proxy['password']);
- @curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy['auth']);
- }
- //Only return response code?
- if($responsecode)
- {
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- @curl_exec($ch);
- $result = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
- }else //Return whole page
- {
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- $result = @curl_exec($ch);
- if(@curl_errno($ch)){ // should be 0
- return curl_error($ch);
- }
- }
- @curl_close($ch);
- return $result;
- }
- echo Scrape_GetURLContent('http://vixcentral.com/ajax_update/?_=' . time(), false);
- //echo Scrape_GetURLContent('https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending', true);
- //echo time();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement