Jump to content

allow_url_fopen disabled


Recommended Posts

Hi,
My host does not allow allow_url_fopen, when I contacted support, they replied.. ask developer to use this code (code below)

Since I dont understand php much.. I am posting it here, if some one can help with changing code or include this as option for users with similar limitations

$file_contents = file_get_contents('http://example.com/ ');

// display file

echo $file_contents;

?>

Use this:



$ch = curl_init();

$timeout = 5; // set to zero for no timeout

curl_setopt ($ch, CURLOPT_URL, 'http://example.com ');

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

$file_contents = curl_exec($ch);

curl_close($ch);

// display file

echo $file_contents;

?>

.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...