curl-and-php
Re: http proxy works, socks proxy doesn't... help! :)
From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 26 Mar 2004 08:58:37 +0100 (CET)
Date: Fri, 26 Mar 2004 08:58:37 +0100 (CET)
On Thu, 25 Mar 2004 andy_cee_at_hush.ai wrote:
> Having great trouble using PHP5/Curl to pull requests through SOCKS proxy.
If you want to use SOCKS, get curl 7.11.1 and no less. We've done fixes to the
SOCKS code very recently.
> <?php
> $ch = curl_init ();
> curl_setopt ($ch, CURLOPT_URL, "http://localhost/");
> curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
> curl_setopt ($ch, CURLOPT_PROXY, "localhost:1080");
> $result = curl_exec($ch);
This code doesn't tell curl that the proxy is a SOCKS one, and thus it assumes
that the proxy is a HTTP one and that will always fail.
CURLOPT_PROXYTYPE must be set to CURLPROXY_SOCKS5 for socks to work.
-- Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se Dedicated custom curl help for hire: http://haxx.se/curl.htmlReceived on 2004-03-26