Jump to content
Sign in to follow this  

allow_url_fopen disabled

Recommended Posts

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);


// display file

echo $file_contents;



Share this post

Link to post
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
Sign in to follow this  

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More