get one value from xml document in php -
I have a PHP variable that contains XML code. I would like to get only one value from that XML and go together Would like to
This is XML:
3 & lt; / ListId> & Lt; / Item & gt; & Lt; / Subscriberlist & gt; & Lt; / Data & gt; & Lt; / Reaction & gt; I would like to become a Var $ customer and get value (in this case 4)
Can anyone explain me?
On this php.net this doctor will tell you how:
For:
& lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Feedback & gt; & Lt; Status & gt; Success & lt; / Status & gt; & Lt; Data & gt; & Lt; Count & gt; 1 & lt; / Counts & gt; & Lt; Subscriberlist & gt; & Lt; Items & gt; & Lt; Subscriberid & gt; 4 & lt; / Subscriberid & gt; & Lt; EMAILADDRESS & gt; Bbbbbb@bbbbbb.bb< / EMAILADDRESS & gt; & Lt; Format & gt; J & lt; / Format & gt; & Lt; Subscribed & gt; 1314903006 & lt; / Subscribed & gt; & Lt; Confirmation of this & gt; 1 & lt; / Confirm & gt; & Lt; Unsubscribe & gt; 0 & lt; / Unsubscribed & gt; & Lt; Bounce & gt; 0 & lt; / Bounce & gt; & Lt; ListId> 3 & lt; / ListId> & Lt; / Item & gt; & Lt; / Subscriberlist & gt; & Lt; / Data & gt; & Lt; / Reaction & gt; If the XML was inside $ xmlstr , you will need the following php code to get the customer: & Lt;? Php $ xml = New Simple XML ($ xmlstr); $ Consumer = $ xml- & gt; Data-> Customer List- & gt; Item- & gt; Membership; ? & Gt;
Comments
Post a Comment