Jump to content

if file_exists for calling a xml file


etrader

Recommended Posts

I want to get suggested keywords from yahoo api service. When xml file is empty (no keyword), it gives error. To resolve this problem I used this code:

if (file_exists('http://search.yahooapis.com/WebSearchService/V1/relatedSuggestion?appid=YahooDemo&query=Madonna&results=2')) {
$xmlmetades = simplexml_load_file('http://search.yahooapis.com/WebSearchService/V1/relatedSuggestion?appid=YahooDemo&query=Madonna&results=2');
}

 

Since it is not a normal .xml file, it is always considered no file, and return nothing.

Link to comment
https://forums.phpfreaks.com/topic/225947-if-file_exists-for-calling-a-xml-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.