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


Re: HTTP Basic auth (was Re: debugging PHP-CURL code)

From: Emmanuel Forgues <>
Date: Tue, 29 Nov 2005 11:18:59 +0100

Here is my code :

        $url="http://". $proxy .":3132". $path;

        $cUrl = curl_init();
        curl_setopt($cUrl, CURLOPT_URL, $url);
        curl_setopt($cUrl, CURLOPT_HEADER, 0);
        curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($cUrl, CURLOPT_USERPWD, "login:passwd");
        curl_setopt($cUrl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        curl_setopt($cUrl, CURLOPT_PORT, "8081");

        $store = curl_exec($cUrl);
        echo $store;

but "$store" in this example is empty. Any idea ?


> The example I posted yesterday and the day before has
> CURLOPT_USERPWD in it. Obviously I have the uid/pw x'd out but it's
> really simple. If you give it a valid ht domain userid/password then
> you can get the page. That was never the issue with my script. And I
> have since solved the issue I was having
> with that script. even though nobody on this list responded to my
> email.
> On Wed, 2005-11-23 at 12:30 +0100, Daniel Stenberg wrote:
>>On Wed, 23 Nov 2005, Emmanuel Forgues wrote:
>>>My appologies, it's not link to Callback. It's another problem.
>>Then please don't reply to a thread about something else and please use a
>>descriptive subject for your new thread.
>>Set CURLOPT_USERPWD to "username:password" and you'll get Basic authentication
>>when using a HTTP URL.
>>You can optionally change Basic method to another one by using the
>>If anyone has a littl example showing these options in action, then please
>>send it my way!
> _______________________________________________

Received on 2005-11-29