Получить исходный код страницы CURL

Статус
В этой теме нельзя размещать новые ответы.
ага, там будет cURL support enabled
 
я не нашел эту строчку. Подскажите может где-то её можно прописать?
 
На denwere есть файл php.ini найди в нем строчку
;extension=php_curl.dll
; - означает что расширение отключено.
Убираеш ; restart denwera и у тедя работает CURL
Просто PHP магия :)
 
PHP:
<?php
set_time_limit(0);
ob_implicit_flush ();
 
// Функция получения страницы с использованием курла
function get_page($url,$post='',$ref='',$cookie='',$ua="Opera 9.64 (compatible; MSIE 6.0; Windows NT 5.1; ru)",$proxy='') {
    $ch = curl_init();
 
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_USERAGENT,$ua);
    curl_setopt($ch, CURLOPT_REFERER,$ref);
    curl_setopt($ch, CURLOPT_PROXY , $proxy);
 
    if($post!==''){
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
 
    $headers [] = "Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1";
    $headers [] = "Accept-Language: ru,en;q=0.9,ru-RU;q=0.8";
    $headers [] = "Connection: close";
    $headers [] = "Cache-Control: no-store, no-cache, must-revalidate";
 
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_HEADER, 1); // тут лучше поставить 0, если куки не нужны
    curl_setopt($ch, CURLOPT_FAILONERROR, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    @curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
    $result = curl_exec($ch);
    curl_close($ch);
    if($result)return $result; else    return false;
}
 
function get_cookie($page) { // и бонус, для парсинга кукисов
    if(preg_match("|Set-Cookie: (.*)\n|Uis",$page,$rnd)) return $rnd[1];
else return false;
}
?>
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху