Can anyone shed some light on the different between CURLAUTH_NEGOTIATE in PHP libcurl (PHP 5.6.4 running on Windows with libcurl v7.39.0) and --negotiate in cURL 7.57.0?
The following request using cURL 7.57.0 via the command line works:
curl --negotiate -u MYDOMAIN\myuser:mypass http://myip:myport/mywebservice.svc
When I try the code below using PHP 5.6.4 (running on Windows) with libcurl v7.39.0 the remote web server returns a 401.2 error:
<?php
//Set vars
$url = "http://myip:myport/mywebservice.svc"; // asmx URL of WSDL
$un = "myuser"; // username
$password = "mypass"; // password
$domain = "MYDOMAIN\\"; // domain
//Create, Send and Output cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NEGOTIATE);
curl_setopt($ch, CURLOPT_USERPWD, $domain . $un.":".$password);
$response = curl_exec($ch);
echo $response;
?>
Here are the PHP CURL Settings:
cURL support => enabled
cURL Information => 7.39.0
Age => 3
**Features**
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => No
SPNEGO => Yes
SSL => Yes
SSPI => Yes
TLS-SRP => No
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host => i386-pc-win32
SSL Version OpenSSL/1.0.1i
ZLib Version => 1.2.7.3
libSSH Version => libssh2/1.4.3
Any insights are greatly appreciated! Thanks ~Dan