|
Posted by "ET Support" on 01/19/06 00:39
Hi Ron,
Not aware of an existing function for that task... but - since it looks like
all the value are strictly in quotes (="value") - if you know all the 'var's
ahead of time (such as 'carrier') then you could extract the data fairly
easily going through the data line by line checking with strpos and using
substr to get the values... it'll take some work, but it'll do the job...
Cheers,
Ben
-----Original Message-----
From: Ron Eggler (Paykiosks) [mailto:ron@paykiosks.net]
Sent: Wednesday, January 18, 2006 2:12 PM
To: php-general@lists.php.net
Subject: parse string
Hi,
I need to parse a String like pasted below for all information (values)
those are included like 'var=value'. How can I do that? Are there any
XML-parsing functions available those'd fit for that job? I've ust found
that one (http://ca.php.net/simplexml) but it seems like i could use it
only for exctracting the 'terms' cause they're in the format that
simplexml
expects.
Thank you for every help!
[String]
<xs:response xmlns:xs="urn:pinXpressSchema">
<SKUlisting>
<globalInfo slogan="Welcome to PayGo!" supportPhone="1-866-339-3299"/>
<carrierInfo carrier="Reconex (test)"
icon="https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif" />
<carrierInfo carrier="IDT POSA"
icon="https://www.pinsprepaid.com/image.aspx?name=" />
<carrierInfo carrier="IDT MasterCard"
icon="https://www.pinsprepaid.com/image.aspx?name=" />
<carrierInfo carrier="PLAYPHONE (Test)"
icon="https://www.pinsprepaid.com/image.aspx?name=PlayPhone-200x100.gif" />
<carrierInfo carrier="EWI POSA TEST"
icon="https://www.pinsprepaid.com/image.aspx?name=PayGo_200_100.gif" />
<carrierInfo carrier="IDT POSA"
icon="https://www.pinsprepaid.com/image.aspx?name=" />
<carrierInfo carrier="IDT Visa"
icon="https://www.pinsprepaid.com/image.aspx?name=" />
<carrierInfo carrier="Bell Mobility (TEST)"
icon="https://www.pinsprepaid.com/image.aspx?name=" />
<carrierInfo carrier="Boost Mobile (Test)"
icon="https://www.pinsprepaid.com/image.aspx?name=c59-BoostMobile.gif" />
<carrierInfo carrier="Cingular (test)"
icon="https://www.pinsprepaid.com/image.aspx?name=cing-blue.gif" />
<carrierInfo carrier="Page Plus (Test)"
icon="https://www.pinsprepaid.com/image.aspx?name=pageplus.gif" />
<carrierInfo carrier="T-Mobile (test)"
icon="https://www.pinsprepaid.com/image.aspx?name=c29-t-mobile_ticketlogo.gi
f" />
<carrierInfo carrier="Unefon"
icon="https://www.pinsprepaid.com/image.aspx?name=unefon_logo.gif" />
<carrierInfo carrier="Verizon (test)"
icon="https://www.pinsprepaid.com/image.aspx?name=verizon.gif" />
<carrierInfo carrier="Virgin Mobile (test)"
icon="https://www.pinsprepaid.com/image.aspx?name=Virgin+Mobile
+200x100.gif" />
<cardSKU category="Local Dial Tone/Telephone Service" distributor="EWI"
discontinued="false" cardtype="PIN" transactionType="PURC">
<card cardID="180" carrier="Reconex (test)" partNumber="PN-180"
region="Optional Services (test)" amount="5" wholesalePrice="4.5"
icon="https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"
upc="870368000420">
<cinfo costPerMinute="" lifetime="0" longDistRate="" roamingRate=""
numberOfMin=""/>
</card>
<terms>
Refer to the Reconex brochure for complete terms and conditions.
</terms>
<pinfo type="Optional Services" value="Call Forwarding, Call Waiting,
Caller ID, Three Way Calling, Speed Dialing & Non-Published
Number"/>
</cardSKU>
<cardSKU category="Local Dial Tone/Telephone Service" distributor="EWI"
discontinued="false" cardtype="PIN" transactionType="PURC">
<card cardID="181" carrier="Reconex (test)" partNumber="PN-181"
region="Optional Services (test)" amount="10" wholesalePrice="9"
icon="https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"
upc="870368000437">
<cinfo costPerMinute="" lifetime="0" longDistRate="" roamingRate=""
numberOfMin=""/>
</card>
<terms>
Refer to the Reconex brochure for complete terms and conditions.
</terms>
<pinfo type="Optional Services" value="Call Forwarding, Call Waiting,
Caller ID, Three Way Calling, Speed Dialing & Non-Published
Number"/>
</cardSKU>
<cardSKU category="Local Dial Tone/Telephone Service" distributor="EWI"
discontinued="false" cardtype="PIN" transactionType="PURC">
<card cardID="178" carrier="Reconex (test)" partNumber="PN-178"
region="Regional Refill (test)" amount="52.99" wholesalePrice="47.7"
icon="https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"
upc="870368000413">
<cinfo costPerMinute="" lifetime="0" longDistRate="" roamingRate=""
numberOfMin=""/>
</card>
<terms>
Refer to the Reconex brochure for complete terms and conditions.
</terms>
<pinfo type="Basic Service" value="Includes 30 days of basic service
in
select states. Also includes variable state, federal & service line
fees"/>
</cardSKU>
<cardSKU category="Local Dial Tone/Telephone Service" distributor="EWI"
discontinued="false" cardtype="PIN" transactionType="PURC">
<card cardID="177" carrier="Reconex (test)" partNumber="PN-177"
region="Regional Starter (test)" amount="39" wholesalePrice="35.1"
icon="https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"
upc="870368000406">
<cinfo costPerMinute="" lifetime="0" longDistRate="" roamingRate=""
numberOfMin=""/>
</card>
<terms>
Refer to the Reconex brochure for complete terms and conditions.
</terms>
<pinfo type="Basic Service" value="15 Days of basic service"/>
</cardSKU>
[/String]
Navigation:
[Reply to this message]
|