Quote:
Originally Posted by pornmasta
i tried that with an incompatible browser but it is not enough.
|
PHP Code:
function file_get_contents_curl($url){
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20); // some large value to allow curl to run for a long time
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_REFERER, $url);
$data = curl_exec($ch);
curl_close ($ch);
return $data;
}
echo file_get_contents_curl('http://www.epochstats.com/webmasters/index.php');
Quote:
HTTP/1.1 302 Found
Date: Sun, 14 Jun 2015 19:57:24 GMT
Server: Apache
Strict-Transport-Security: max-age=63072000; includeSubdomains; preload
X-Content-Type-Options: nosniff
Location: https://www.epochstats.com/webmasters/index.php
Content-Length: 231
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 200 OK
Date: Sun, 14 Jun 2015 19:57:25 GMT
Server: Apache
Set-Cookie: PHPSESSID=33c7abf903f5be9e51c32fa9b51c0a8b; path=/; domain=epochstats.com; secure
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Strict-Transport-Security: max-age=63072000; includeSubdomains; preload
X-Content-Type-Options: nosniff
Vary: Accept-Encoding
P3P: CP="ADMa OUR IND DSP IDC COR", policyref="/w3c/p3p.xml"
Transfer-Encoding: chunked
Content-Type: text/html
|
you see only user agent and referer are sent and i can load the page, if i skip the referer then still page is loading fine.,
the first response saying correct url is
https://www.epochstats.com/webmasters/index.php
tried commenting the user agent too and still loading page.,
so only these are required ., new function .,
PHP Code:
function file_get_contents_curl($url){
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close ($ch);
return $data;
}
try url with https.