Why doesn't cURL work on PHP5?

software development

#1

Hello, I’ve been trying to use the PHP function simplexml_load_file but I gather that it’s been disabled.

The support wiki suggests using cURL instead and even provides a function to emulate simplexml_load_file but whenever I run it I get nothing back.

I’ve tried one of my own functions (which I know works) which uses cURL to access a remote url and it works on Dreamhost on an account running PHP4 but not PHP5.

Is cURL broken or is there a way to get it to run on PHP5 ? Running the cURL functions locally on my laptop which is running the NuSphere development environment works perfectly so I know that it’s not the code that’s the problem.

Thanks in advance

Phil


#2

It might be this:

Default for cURL is to follow redirects, but this seems not to be the default on dreamhost. Add this to your script:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

and try again.