URL file access with a cURL backup

So in the process of getting my website up and running, I ran into the ‘URL file-access is disabled in the server configuration’ message. Since the server admin was asleep, I figured I’d try to find a workaround. cURL is a commonly used one for this scenario, but the problem is that if you switch hosts it may not be available. As such, here’s a handy variable to tell if URL file access is enabled:

ini_get('allow_url_fopen')

It returns true or false depending on the value in the php.ini file, and you can throw it in an if statement to test for it, and use cURL in the else statement in case it fails.

Leave a Reply

Your email address will not be published.

Required fields are marked *

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>