Ответов: 9 Просмотров: 778
|
OrmaJever
<?php
function curl($url='', $post='', $referer='', $proxy='')
{
$cl = curl_init();
curl_setopt($cl, CURLOPT_URL, $url);
curl_setopt($cl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($cl, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.2.15 Version/10.10');
curl_setopt($cl, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt');
curl_setopt($cl, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt');
if(!empty($post)) {curl_setopt($cl, CURLOPT_POST, 1); curl_setopt($cl, CURLOPT_POSTFIELDS, $post);}else{curl_setopt($cl, CURLOPT_POST, 0);}
if(!empty($referer)){curl_setopt($cl, CURLOPT_REFERER, $referer);}else{curl_setopt($cl,CURLOPT_REFERER, 1);}
if(!empty($proxy)) {curl_setopt($cl, CURLOPT_PROXY, $proxy);}
$ex=curl_exec($cl);
curl_close($cl);
return $ex;
}
$t=curl('http://www.rambler.ru');
echo $t;
?>
в таком варианте не работает
файла с куки не появилось в документрут |