P
P
psfpro2016-04-20 22:42:15
PHP
psfpro, 2016-04-20 22:42:15

Why is php curl host not resolving?

Host not resolved from Php script. From the console everything finds and everything works. What can be wrong?

$url = 'http://google.com/';

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_VERBOSE, true);
        var_dump(curl_exec($ch));
        var_dump(curl_error($ch));

Result
bool(false) string(34) "Could not resolve host: google.com"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
psfpro, 2016-04-20
@psfpro

Helped resolver 8.8.8.8 valid=30s; in nginx.conf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question