Hello Everyone,
I have been searching and trying to figure out how to do this all day everything i tried seemed not to work.
I am trying to gather XML file contents via simplexml. My XML files are dynamic, as in it has a keyword and it will pull the xml file according to the keyword. However not all keywords return valid entries. But the url will exist it just wont have any of the item fields but it does have a field that will say <totalResultCount>0</totalResultCount>
Now what i am wanting to do is for it to check if fields exist(or if totalresultcount is 0) if they dont exist it would show a default feed. I have tried a few different things and nothing seems to work. Here is what my most recent code looked like.
<?php
if(!file_exists("xmlfile.php?keywords=".$page_artistu.""))
{
$tfeed = "xmlfile.php?keywords=".$page_artistu."";
}
else {
$tfeed = "xmlfile.php?keywords=default";
}
$lfeed = @simplexml_load_file("$tfeed");
So pretty much if the xmlfile with the dynamic keyword returns actual fields than use it if theres no fields or if for the field totalResultCount 0 it would show the default feed.
Obviously the file exists everytime it just doenst have entries, so if anyone has any suggestions or ideas i am all ears.
Thank You,
Dave