PHP to fetch XML file into a string from external server

I was unaware of proxy requirements on some hosts. That could very well be the problem.

I’ve used cURL in a few scripts but I have never used CURLOPT_HEADER and I have always used CURLOPT_CONNECTTIMEOUT

If you try this does it work?

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
'http://dd.weatheroffice.ec.gc.ca/citypage_weather/xml/NS/s0000450_e.xml');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xmlContents = curl_exec($ch);

print("XML contents = ");
print_r($xmlContents);
print("\
");

curl_close($ch);

I mean the PHP file; your host may have proxy requirements. As i said, i know GoDaddy have proxy requirements to reach out to an external server.

The file is provided to me by an outside server. As I mentioned before, if I copy the file onto my own host it works fine. How do I know if I need to use a proxy?

are you hosting this file on your own server, or with a company?

Some hosting companies (GoDaddy notably) require you to use a proxy server with cURL.