Turn Off fopen() for URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Turn Off fopen() for URL

Post by tecktalkcm0391 »

How can I turn fopen() for URLs on because i keep getting this message

URL file-access is disabled in the server configuration in


EDIT: Acutally, what can I do in place of this, because I found the answer, but I don't have access to php.ini
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Try the cURL library. Check your phpinfo() if you have that PHP extension installed.
(#10850)
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

It is installed...

I was using:

Code: Select all

$fp = fopen($state,"r");
	while($data_in = fread($fp, 4096)){
		$data_output[] = $data_in;
	}
	$data = join('',$data_output);
	fclose($fp);


would this be right for cURL:

Code: Select all

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $state);
$getresponse = curl_exec ($ch);
$data = $getresponse;
curl_close($ch);
I want to make sure, because the site is live... but my host, had to randomly remove it without telling me.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

That isn't working... how would I do it for an XML File....
Post Reply