URL file-access is disabled in the server configur


#1

I have the following line of code:

$dom->loadHTMLFile(‘http://www.occc.net/iebms/coe/coe_p1_all.aspx?oc=10&cc=COEMAIN’);

causing the following warning:

Warning: DOMDocument::loadHTMLFile() [function.DOMDocument-loadHTMLFile]: URL file-access is disabled in the server configuration in /home/.obsididan/munnelly/arcticassassins.com/orlandoscrape.php on line 22

From what I understand it is common for hosting companies to block URL file-access. Is there an easy way around this?

Thanks!


#2

The standard fix for this sort of trouble is to use cURL to download the target page rather than using allow_url_fopen. General instructions for how to do this can be found on the wiki. cURL will load the target page into a string which you can then parse using $dom->loadHTML($curl_result);


#3

Wow, that was quick! Thanks for the help, I’ll give it a try.