$fp = fopen("http://feeds.reuters.com/Reuters/PoliticsNews?format=xml","r")
or die("Error reading RSS data.");
The above coding working correctly in localhost;;;
but in server display “Error reading RSS data.”…
i dont know why….
anybody please explain me…
i am waiting…
thanks
A possible reason could be that
allow_url_fopenmight be disabled (quoting) :You can check using the
phpinfo()function, to see if it’s enabled or not.If it’s not enabled, you’ll have to use another solution to send the HTTP request that fetches that remote content.
Using curl might be a solution, for instance ; see
curl_execfor a quick example, andcurl_setoptfor a list of all possible options.Here’s what a simple request would look like, though :
This will get you the content of the feed in
$feed— but check the manual page ofcurl_setopt: there are so many options that going through the list cannot be a bad idea.Still, as a precaution, before going this way, you might want to check if curl is enabled, is the output of `phpinfo()`…