Using xpath on a PHP SimpleXML object, SOAP + namespaces (not working..)

后端 未结 2 941
我寻月下人不归
我寻月下人不归 2020-12-06 15:47

After researching this on SO and google for hours now... I hope to get some help here: (I am just one step away from running a regex to remove the namespaces completely)

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 16:42

    The multiple namespaces are messing with it, adding the following works for me

    $response->registerXPathNamespace("site", "http://webservices.site.com/definitions");
    $_res = $response->xpath('//site:SessionId');
    

    also, see this previous stack overflow question

提交回复
热议问题