Jump to content

SimpleXML and colons?


cat3

Recommended Posts

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.