Google Groups

php5-curl error: couldn't resolve host

Jacob Yocom-Piatt May 18, 2006 3:42 PM
Posted in group: lucky.openbsd.misc
i'm trying to get the php5-curl-5.0.4p0 module working with some php code that's
running on a 3.8-release machine. this code makes XML requests to UPS to get
shipping costs and times. when the php attempts to use curl to contact the UPS
web address , it craps out and gives
an error:

Error from cURL: Error [6]: Couldn't resolve host ''

i suspect this is an issue with running from inside the apache chroot, but do
not know how to proceed and/or confirm this suspicion. just to be thorough,
here's the chunk of php code that generates the error:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest);
curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);

if ($this->logfile) {
  error_log("UPS REQUEST: " . $xmlRequest . "\n", 3, $this->logfile);
$xmlResponse = curl_exec ($ch);
if (curl_errno($ch) && $this->logfile) {
  $error_from_curl = sprintf('Error [%d]: %s', curl_errno($ch), curl_error($ch));
  error_log("Error from cURL: " . $error_from_curl . "\n", 3, $this->logfile);

i presume url = the url i gave above.

any advice appreciated.