PHP5 and file_get_contents(url)

software development

#1

Hi,

I’m currently making an application that loads an XML file from a remote site and then converts that data as needed. However I get an error when loading it :

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /xxxx/.xxxx/xxxx/index.php on line 3

Is it planned to enable URL file-access in the near future?


#2

About URL file access
How to remedy it


#3

If you dont want to use curl you can compile php yourself and enable it.


#4

Or alternatively… just post your login & password on your website and make it easy for hackers.

:wink:

btf


#5

Going to look into that cURL thing. I suppose I could offer that and FTPing of the XML file for those who don’t have cURL on their server.

Thanks for the comments :slight_smile:


#6

I don’t know the details of what you’re doing, so this may not apply, but my preferred approach is to retreive external data (mostly RSS) perodically via a cron job. This means my pages only parse local files instead of retreiving remote ones and so my site isn’t affected by outages or slowness of the remote servers.


If you want useful replies, ask smart questions.


#7

It could definitly apply :slight_smile: One of the future expansions of the script will be tracking the time of last update, and if that goes over a certain amount of time then running an update.

The more I can keep in the PHP code the better.

As for what it is … well the project is still very young :slight_smile: Until it’s grown up a bit and has a bit more “everyone can understand” functionality (instead of the current quick fixes so the wife can use it on her page) I’ll just work on it and maybe post here when it’s done :slight_smile: