cat3 Posted April 6, 2008 Share Posted April 6, 2008 Hey there! I'm working on an application that uses the White Pages API, which returns all queried data in XML. I'm trying to use SimpleXML to read the query status code, which is returned in the second line of the code below ("wp:code="No Data Found""). I want my application to do different things based on the code returned (ie; "No Data Found" = show error, "Data Found" = show listing, etc.), but I'm having trouble reading this part of the XML... I'm trying to use $simplexml->wp:wp->wp:result->attributes(); but the colons keep getting in the way and I get an error: Parse error: syntax error, unexpected ':' in /home/******/public_html/******/inc/xml.php on line 9. Any ideas? <wp:wp> <wp:result wp:type="success" wp:message="The search did not find results" wp:code="No Data Found"/> − <wp:meta> <wp:linkexpiration>2008-04-11</wp:linkexpiration> <wp:recordrange wp:lastrecord="0" wp:firstrecord="0" wp:totalavailable="0"/> <wp:apiversion>1.0</wp:apiversion> − <wp:searchlinks> <wp:link wp:linktext="Whitepages.com" wp:type="homepage">http://www.whitepages.com/*****/</wp:link> − <wp:link wp:linktext="Link to this api call" wp:type="self"> http://api.whitepages.com/reverse_phone/1.0/?phone=**********;api_key=***************************** </wp:link> </wp:searchlinks> </wp:meta> </wp:wp> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.