I can use curl to access regular http urls, but not https urls. curl is new to me and I am totally lost.
Code: Select all
$ch = curl_init(); // create cURL handle (ch)
if (!$ch) {
die("Couldn't initialize a cURL handle");
} else {
echo 'curl handle initialized<br />';
}
// set some cURL options
$ret = curl_setopt($ch, CURLOPT_URL, "https://wwwcie.ups.com/ups.app/xml/Rate");
$ret = curl_setopt($ch, CURLOPT_HEADER, 1);
$ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$ret = curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlstr);
// 4 new lines trying to get https to work
$ret = curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, false);
$ret = curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
// execute
$ret = curl_exec($ch);
if (empty($ret)) {
echo '<br />some kind of an error happened<br />';
die(curl_error($ch));
curl_close($ch); // close cURL handler
} else {
$info = curl_getinfo($ch);
curl_close($ch); // close cURL handler
if (empty($info['http_code'])) {
die("No HTTP code was returned");
} else {
echo "The server responded: <br />";
echo $info['http_code'];
}
}Here is what I am working with:
Any help would be really appreciated!php version 5.1.4
libcurl 7.10.6
openssl 0.9.7a