binskarleone
New Member
I'm trying to get content of this site: http://www.gratka.pl/, but I recieve only this:\[quote\] * About to connect() to gratka.pl port 80
* Trying 195.8.99.42... * connected
* Connected to gratka.pl (195.8.99.42) port 80
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Host: gratka.pl
Accept: */* < HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-length: 0
< Location: ..
* Connection #0 to host gratka.pl left intact
* Issue another request to this URL: 'http://blad.gratka.pl/403.html'
* About to connect() to blad.gratka.pl port 80
* Trying 195.8.99.1... * connected
* Connected to blad.gratka.pl (195.8.99.1) port 80
GET /403.html HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Host: blad.gratka.pl
Accept: */*
...
< HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-length: 0
< Location: http://blad.gratka.pl/403.html
* Connection #1 to host blad.gratka.pl left intact
* Maximum (20) redirects followed
* Closing connection #0
* Closing connection #1
\[/quote\]What means that script which I always use to grab content isn't working:\[quote\] $ch = curl_init();
$timeout = 15;
$cookie_file_path = 'c.txt';
$fp = fopen($cookie_file_path, "w");
fclose($fp);
$url = 'http://gratka.pl';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2');
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$info = curl_exec($ch);
curl_close($ch);
\[/quote\]After executing script cookie file (c.txt) is empty. What's wrong? Maybe site needs valid cookies or maybe it's matter of correct HTTP headers? Any help will be greatly appreciated!EDIT: When I execute above script on my localhost it's working, but it's not working when executing on dedicated server. Any guess?
* Trying 195.8.99.42... * connected
* Connected to gratka.pl (195.8.99.42) port 80
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Host: gratka.pl
Accept: */* < HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-length: 0
< Location: ..
* Connection #0 to host gratka.pl left intact
* Issue another request to this URL: 'http://blad.gratka.pl/403.html'
* About to connect() to blad.gratka.pl port 80
* Trying 195.8.99.1... * connected
* Connected to blad.gratka.pl (195.8.99.1) port 80
GET /403.html HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Host: blad.gratka.pl
Accept: */*
...
< HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-length: 0
< Location: http://blad.gratka.pl/403.html
* Connection #1 to host blad.gratka.pl left intact
* Maximum (20) redirects followed
* Closing connection #0
* Closing connection #1
\[/quote\]What means that script which I always use to grab content isn't working:\[quote\] $ch = curl_init();
$timeout = 15;
$cookie_file_path = 'c.txt';
$fp = fopen($cookie_file_path, "w");
fclose($fp);
$url = 'http://gratka.pl';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2');
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$info = curl_exec($ch);
curl_close($ch);
\[/quote\]After executing script cookie file (c.txt) is empty. What's wrong? Maybe site needs valid cookies or maybe it's matter of correct HTTP headers? Any help will be greatly appreciated!EDIT: When I execute above script on my localhost it's working, but it's not working when executing on dedicated server. Any guess?