cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Curl and proxy

From: Tommaso Trani <trani_at_softwareplanet.net>
Date: Wed, 18 May 2005 14:50:11 +0200

Hi,
    I'm trying to use curl with php to fetch webpages through proxies, but I'm unable to do it.

I've tried this code:

<?
    error_reporting(E_ALL);
    $ch = curl_init ();
    curl_setopt ($ch, CURLOPT_URL, "http://www.google.com/");
    curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
    curl_setopt ($ch, CURLOPT_PROXY, "24.44.68.212:5542");
    curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt ($ch, CURLOPT_FAILONERROR, true);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result = curl_exec($ch);
    print curl_errno ($ch);
    print $result;
    curl_close ($ch);
?>

But I've the following errors/notices:

Notice: Use of undefined constant CURLOPT_PROXYTYPE - assumed 'CURLOPT_PROXYTYPE' in c:\documents and settings\tommaso\desktop\siti\scambiolink\proxy.php on line 7

Notice: Use of undefined constant CURLPROXY_SOCKS5 - assumed 'CURLPROXY_SOCKS5' in c:\documents and settings\tommaso\desktop\siti\scambiolink\proxy.php on line 7

On my system I've installed libcurl/7.11.2 OpenSSL/0.9.7c zlib/1.1.4 with php 4.3.9 and on http://it2.php.net/curl_setopt I read that this options are available in CURL 7.10 (my version is greater)

Could you please help me?

Thanks
Tom
Received on 2005-05-18