Napisałem coś takiego:
$c = curl_init(); curl_setopt($c, CURLOPT_URL, "http://www.5stadion.pl/"); curl_setopt($c, CURLOPT_POST, 1);//przesylamy metodą post curl_setopt($c, CURLOPT_POSTFIELDS, 'day=24&month=02&year=1993'); //dane do wyslania curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_HEADER , 1); curl_setopt($c, CURLOPT_COOKIEFILE, 'cookie.txt'); curl_setopt($c, CURLOPT_COOKIEJAR,'cookie.txt'); $page = curl_exec($c); curl_close($c);
nietsety nie działa
z http live headers dostałem coś takiego:
Kod
http://www.5stadion.pl/
POST / HTTP/1.1
Host: www.5stadion.pl
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: symfony=hdktb0m9qe7j02o6bgs3d5iv50; __utma=45461728.653323275.1340272646.1340272646.1340272646.1; __utmb=45461728.2.10.1340272646; __utmc=45461728; __utmz=45461728.1340272646.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Content-Type: application/x-www-form-urlencoded
Content-Length: 25
day=24&month=02&year=1993
HTTP/1.1 302 Found
Server: nginx
Date: Thu, 21 Jun 2012 09:58:23 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
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
Location: http://www.5stadion.pl/
POST / HTTP/1.1
Host: www.5stadion.pl
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: symfony=hdktb0m9qe7j02o6bgs3d5iv50; __utma=45461728.653323275.1340272646.1340272646.1340272646.1; __utmb=45461728.2.10.1340272646; __utmc=45461728; __utmz=45461728.1340272646.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Content-Type: application/x-www-form-urlencoded
Content-Length: 25
day=24&month=02&year=1993
HTTP/1.1 302 Found
Server: nginx
Date: Thu, 21 Jun 2012 09:58:23 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
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
Location: http://www.5stadion.pl/
EDIT:
mam również problem z logowaniem
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.5stadion.pl/logowanie"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_COOKIESESSION, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=email&password=haslo&fb_login=0&redirect=lottery%2Findex'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_exec($ch); $page = curl_exec($ch); curl_close($ch);
http live headers
Kod
http://www.5stadion.pl/logowanie
POST /logowanie HTTP/1.1
Host: www.5stadion.pl
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1
Accept: */*
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 79
Cookie: __utma=45461728.1365950345.1340272789.1340272789.1340272796.2; __utmb=45461728.42.10.1340272796; __utmc=45461728; _mthe=true; symfony=hkh320h4k0gmc6mb4mtpv0qbe6
Pragma: no-cache
Cache-Control: no-cache
email=email&password=haslo&fb_login=0&redirect=lottery%2Findex
HTTP/1.1 302 Found
Server: nginx
Date: Thu, 21 Jun 2012 10:51:05 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
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
Set-Cookie: symfony=gcjeoruk0deq1rb9k4al7qlp74; path=/
Location: http://www.5stadion.pl/konkurs
POST /logowanie HTTP/1.1
Host: www.5stadion.pl
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1
Accept: */*
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 79
Cookie: __utma=45461728.1365950345.1340272789.1340272789.1340272796.2; __utmb=45461728.42.10.1340272796; __utmc=45461728; _mthe=true; symfony=hkh320h4k0gmc6mb4mtpv0qbe6
Pragma: no-cache
Cache-Control: no-cache
email=email&password=haslo&fb_login=0&redirect=lottery%2Findex
HTTP/1.1 302 Found
Server: nginx
Date: Thu, 21 Jun 2012 10:51:05 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
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
Set-Cookie: symfony=gcjeoruk0deq1rb9k4al7qlp74; path=/
Location: http://www.5stadion.pl/konkurs
Pozdrawiam