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

curl-and-php

Re: php ntlm failing

From: David Boyd <dboyd_at_fullmoonsoft.com>
Date: Tue, 30 May 2006 14:29:25 -0400 (EDT)

use ethereal and see what headers are being passed with the browser and
emulate them.

dav
> I have a very simple script that I thought would be a piece of cake
> but I can't get the authentication to work.
>
> Here is the script
>
> <?php
> $c = curl_init('http://url');
> curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($c, CURLOPT_USERPWD, "username:pass");
> curl_setopt($c, CURLOPT_VERBOSE, TRUE );
> curl_setopt($c, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
> $page = curl_exec($c);
> curl_close($c);
> echo( $page );
> ?>
>
> Here is the verbose output
>
> * About to connect() to blah.com:80
> * Connected to blah.com (64.187.16.144) port 80
>> GET /page HTTP/1.1
> Authorization: Basic dHV2JTVjdmlxdWEtZ2V0dGF4OiUyNFNQTSUyM2xtayUyQjZ+
> Host: blah.com
> Pragma: no-cache
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
>
> < HTTP/1.1 401 Access Denied
> < Connection: close
> < Content-Length: 4431
> < Date: Tue, 30 May 2006 18:11:02 GMT
> < Content-Type: text/html
> < Server: Microsoft-IIS/5.0
> < WWW-Authenticate: Negotiate
> < WWW-Authenticate: NTLM
> * Closing connection #0
>
> If I enter http://username:pass@blah.com into a browser it works just
> fine. So I have no clue what is wrong.
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

-- 
703-727-1312 Mobile
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-05-30