parsing SOAP XML response with php

前端 未结 2 1506
后悔当初
后悔当初 2021-01-06 23:13

I have checked multiple examples and the w3Schools tutorial but I can\'t figure out the structure of the SOAP response. I haven\'t touch php/xml in more than 10 years so you

2条回答
  •  长发绾君心
    2021-01-07 00:09

    retrieve value from this type response 
    
    
    
    
        
            
                
                    
                        
                            
                                
                                    
                                        
                                            
                                                
                                                    
                                                    
    
                                                    
                                                    
                                                
                                            
                                        
                                    
                                
                            
                        
                        
                            
                                1Ahmedabad23.04583972.550578
    21Amritsar31.70560374.807337

    using this code you can easily get all the Tables data in $title variable and using that you can easily get any specific value easily...

                    $sxe = new SimpleXMLElement($response);
                    $sxe->registerXPathNamespace('d', 'urn:schemas-microsoft-com:xml-diffgram-v1');
                    $result = $sxe->xpath("//NewDataSet");
                    echo "
    ";
                    //print_r($result[0]);
                    foreach ($result[0] as $title) {
                        print_r($title);
    
                    }
    

提交回复
热议问题