I have the following code:
$body = "<SOAP-ENV:Envelope>".$data."</SOAP-ENV:Envelope>";
$ch = curl_init($FD_Add);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "WS******._.1:********");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSLCERT, DIR_ROOT."ABCDEFG/Certs/WS******._.1.pem");
curl_setopt($ch, CURLOPT_SSLKEY, DIR_ROOT."ABCDEFG/Certs/WS******._.1.key");
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "ckp_***********");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
if($test_env){echo 'The result of your request is:<RESULT>'.$result.'</RESULT>br/>' ;}
curl_close($ch);
The response is an error 401 HTTP requires authentication. I have verified the user ID and Password to be correct. What I am wondering first is if the version of PHP could cause this error if it does not support CULROPT_AUTH as I am running PHP~v. 3.4 which from what I read does not support this option.
Anybody know if this could be the trouble?
You could probably fake it by issuing the basic auth header yourself:
but that’s only available since Curl 7.10.3 and later. Your stone-age PHP is most likely using an equally stone-age CURL.
Really… PHP 3.4 is the equivalent of driving around in a car bought from the Flintstones. You should upgrade to something more modern, like a Model-T… those horseless carriages are pretty impressive.