|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I have some PHP code that sends webbased from data to an external url ( in the form of an XML data stream ) , and gets an XML data stream back. I've got it displaying the stream via the browser ( using echo $req->getResponseBody(); ). What I want to do is , instead of displaying the stream, is perform a query on it and redirect the browser to a specific page depending on the match or not. Using this data (snippit):- <?xml version="1.0" encoding="utf-8" ?> - <soap:Envelope xmlns:soap="webpage address" xmlns - <soap:Body> - <PerformMLCheckResponse xmlns="webpage"> - <CallResponse> <AcrService>checking</AcrService> <AcrSearchId>myid</AcrSearchId> <AcrReference>refcode</AcrReference> <AcrIntReference>externalcode</AcrIntReference> <AcrExtReference>externalcode</AcrExtReference> <AcrDateTime>2009-10-25T15:15:26.865625+00:00</AcrDateTime> <AcrAccept>Y</AcrAccept> <AcrFormatted>Y</AcrFormatted> <AcrXmlDetail>Y</AcrXmlDetail> - <AcrResponseDetail> - <AcdElectoral> <AerUsed>Y</AerUsed> <AerValid>Y</AerValid> <AerPafMatch>Y</AerPafMatch> <AerForename>David</AerForename> <AerOthernames /> <AerSurname>Brent</AerSurname> - <AerAddress> <AadAbode /> <AadBuilding>22</AadBuilding> <AadStreet>test town</AadStreet> <AadLocality /> <AadPostTown>test street</AadPostTown> <AadPostcode>GU99 1AP</AadPostcode> </AerAddress> <AerStartDate>1996-10-28</AerStartDate> <AerMonths>110</AerMonths> <AerOptOut>Y</AerOptOut> <AerPriorFlag>N</AerPriorFlag> </AcdElectoral> - <AcdCreditHistory> <ChyUsed>Y</ChyUsed> <ChyType>superuser</ChyType> I thought I could use :- $xmlresults = $req->getResponseBody(); $CallResponse = $xmlresults->CallResponse; $AcdCreditHistory = $CallResponse->AcdCreditHistory; $ChyType = $AcdCreditHistory->ChyType; to load the data into a variable ( in this case "superuser" ) and then perform an "if ...Else" on that, but I'm new to PHP and a little lost. Any ideas ? I'm I looking in the right area ? Many thanks |
|
#2
|
|||
|
|||
|
getResponseBody probably just has the html data as a string. you would need to convert it into an object before you can search it.
PHP Code:
however to know if the call to the object is right I would need to see the complete xml file, not just the part down to what data you want. |
|
#3
|
|||
|
|||
|
Thats great. Thank you
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > noob - Parse an XML data stream and redirect browser accordingly |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|