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.

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

great! Curl did the job. Thank you
0

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...

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.