frobak Posted August 14, 2012 Share Posted August 14, 2012 Hi, i'm trying to access parts of this soap response xml, but I just cant get it. I dont understand the diffgram bit for a start. And do i need to think about the soap and vehicle_getvehicleandcomponentpartsresponse namespaces? I need the partnumber! Heres the xml <soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <vehicle_getvehicleandcomponentpartsresponse xmlns="http://tempuri.org/"> <vehicle_getvehicleandcomponentpartsresult> <xs:schema id="NewDataSet" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns=""> <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <newdataset xmlns=""> <stddata msdata:roworder="0" diffgr:id="StdData1"> <enhanceddata msdata:roworder="0" diffgr:id="EnhancedData1"> <parts msdata:roworder="0" diffgr:id="Parts1"> <imagepath>http://topcat.adsapplications.co.uk/ImageStore/no_image.png</imagepath> <supplierid>1992</supplierid> <supplier>UK Reference</supplier> <partnumber>202</partnumber> I'm using curl, and the php code im trying: $result = curl_exec($ch); $enhanced_data = new SimpleXMLElement($result); $bat_part = $enhanced_data->children('diffgr', true)->children()->NewDataSet->Parts->partumber; I know this is wrong, but i have accessed similar data from a similar service, the only difference is the below soap response: <soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <vehicle_getvehicleandcomponentpartsresponse xmlns="http://tempuri.org/"> <vehicle_getvehicleandcomponentpartsresult> Surely this shouldnt be so difficult, am i doing somethign completely wrong? Quote Link to comment https://forums.phpfreaks.com/topic/267066-accessing-simplexml-elements/ Share on other sites More sharing options...
requinix Posted August 14, 2012 Share Posted August 14, 2012 It'd be a lot easier if you used SoapClient instead of cURL. Quote Link to comment https://forums.phpfreaks.com/topic/267066-accessing-simplexml-elements/#findComment-1369387 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.