4

I'm trying a php script that is doing requests with CURL.

But I get the error Couldn't resolve host 'example.com'

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER  , true);
curl_setopt($ch, CURLOPT_URL, 'https://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec( $ch );
if($result === false)
{
    echo 'Error Curl : ' . curl_error($ch);
}
else
{
    echo 'OK';
}

So I started to search the problem, I tried to do requests from my server with ping, curl (CLI) and telnet (that use libc6 like curl apparently) nslookup works fine too

Everything work fine.

So where is the problem ?

Thanks for the help

  • Debian Wheezy
  • libc6 2.19-18
  • PHP 5.6.8-1 (with php-fpm)
  • nginx
Alkalyne
  • 41
  • 1
  • 2
  • 1
    Try the suggestion mentioned here: http://ubuntuforums.org/showthread.php?t=2206748 should be similar in debian – Samar Jun 17 '15 at 04:46
  • If your question would be closed as off-topic, I suggest to retry it http://unix.stackexchange.com . – peterh Jun 17 '15 at 12:13
  • Hello, I tried everything here but it does not work, And it's weird because even curl in command line works... I have a Java server on it that is doing requests and I don't have any problem. It's just php5-curl... – Alkalyne Jun 17 '15 at 20:17

0 Answers0