I have the following code:
$curl = curl_init($query);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLINFO_HEADER_OUT, 1);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
I did upload it as AppFog application and it is working fine. The issue is when I try to run the same code on Windows Server 2008 IIS7 or on WAMP.
I get the following message from the server:
HTTP Status 401 -
type Status report
message description **This request requires HTTP authentication ().**
In seems that I'm not sending the credentials, but 'request_header' has the following value:
POST /example HTTP/1.1
Authorization: Basic example // deliberately removed
Host: example.com
Accept: */*
Connection: close
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
Any ideas what might be the issue? Thanks.