0

I have problem about use curl_exec and it always return "could not resolve host" It worked normally before on production(Ubuntu) and my local but It's not working on production lately because we setting something on server (or firewall I'm not sure). Anyone have any idea about this?

check my code below but I think it's not a cause

                $ch = curl_init(); 
                curl_setopt($ch, CURLOPT_URL,$url);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_TIMEOUT, 3000);
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

                $data = curl_exec($ch); 
                curl_close($ch);
banku
  • 119
  • 6

1 Answers1

0

A good way would be to check errors and show what happened.

// Check if any error occurred
if(curl_errno($ch))
{
    echo 'Curl error: ' . curl_error($ch);
}

Else if you have access to the server, ping the host. It's the easiest way to check that host is available from the production server