I’ve been a happy Dreamhoster for almost a year now. Unfortunately, one of my sites requires “URL file-access,” which has been disabled by Dreamhost for security reasons.
I’m using the function get_headers() to retrieve info from a XML feed.
$fromhere = ‘http://blahblah.xml’;
$Iwantthis = get_headers($fromhere);
I’m new to cURL, so I have issues getting the right syntax.
I currently have:
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $ArtistURL);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
$lines = array();
$lines = explode("\n", $file_contents);
Which works, but doesn’t return the same thing as get_headers();
I later have a function that calls on $Iwantthis, and if I use the cURL method, my code refuses to use it.
Do both cURL and get_headers() return the same thing? If not, what code adoptions can I make to have everything come together?