
13.04.2009, 14:43
|
|
Постоянный
Регистрация: 29.10.2007
Сообщений: 381
С нами:
9754684
Репутация:
65
|
|
PHP код:
$ua = 'User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Widows NT)';
preg_match_all('~Set-Cookie: ([^\r\n]*)[\r\n]~i',$result1,$mass);
$all_cookie_string = implode(" ", $mass[1]);
$PostData = 'http://site.ru/&login='.$login.'&pwd='.$password;
$ref = 'http://site.ru/';
$ch=curl_init ("http://site.ru/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $PostData);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIE, $all_cookie_string);
curl_exec ($ch);
$ch2=curl_init('http://site.ru/нужная_страница.html');
curl_setopt($ch2, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_USERAGENT, $ua);
curl_setopt($ch2, CURLOPT_REFERER, $ref);
curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch2, CURLOPT_COOKIE, $all_cookie_string);
curl_exec ($ch2);
curl_close ($ch);
всеровно только первое выполняется...
|
|
|