tags:

views:

198

answers:

2

When I try to do a file('http://somewebsite.com') i get an error

"URL file-access is disabled in the server configuration"

I tried using ini_set('allow_url_fopen', 'On'); but that didn't work.

I'm using shared hosting. Any suggestions?

All I want to do is read the html source code of a website.

+1  A: 

On php version>4.3.4 and <6, you can't set allow_url_fopen in your script. Try using curl instead.

phihag
great! Curl did the job. Thank you
John
A: 

If your hosting allows and reads custom .htaccess files, try putting the following line to a .htaccess at the root of your project:

php_flag allow_url_fopen on

and see if it has an effect...

Henrik Paul
I tested out of curiosity, and it gave me an Error 500 - Internal server error. Maybe my provider just won't allow it.
John