I'm trying to access www.alberta.ca/ with PHP curl but it returns "Curl failed with error #6: Could not resolve host", although the website is online and returns a nice 200.
Here is my code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.alberta.ca/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
I tried all the solutions I could find, for example adding the following options:
curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false );
curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 2 );
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
But nothing works. Strangely, it works from my localhost, but not from my server.