PHP registerXPathNamespace() error

Paundnarasuek

New Member
\[code\]Fatal error: Call to a member function registerXPathNamespace() on a non-object in /home/gateway/public_html/index.php on line 83\[/code\]So the error i am getting tis above, and on that line is the following\[code\]$host = "services.incard.com.au/telechoicetransservice.asmx";$timestamp = getGMTtimestamp();$vars = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ."<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" . "<soap:Body>" . "<ProcessPayment xmlns=\"https://services.incard.com.au\">". "<auth>" . "<AccountCode>". urlencode($_POST['AccountCode'])."</AccountCode>". "<Username>". urlencode($_POST['AccountCode'])."</Username>". "<Password>". urlencode($_POST['AccountCode'])."</Password>". "</auth>" . "<MerchantNumber>".urlencode($_POST['MerchantNumber'])."</MerchantNumber>" . "<CustomerNumber>".urlencode($_POST['CustomerNumber'])."</CustomerNumber>". "<Amount>".urlencode($_POST['Amount'])."</Amount>". "<Description>".urlencode($_POST['Description'])."</Description>". "</ProcessPayment>"."</soap:Body></soap:Envelope>";$response = openSocket($host, $vars);$xmlres = array();$xmlres = makeXMLTree ($response);$xml = simplexml_load_string($response); $xml->registerXPathNamespace('soap:Envelope', 'http://schemas.xmlsoap.org/soap/envelope/');foreach ($xml->xpath('//soap:Envelope:ResponseCode') as $item) { echo (string) $item; }foreach ($xml->xpath('//soap:Envelope:ResponseDescription') as $item) { echo (string) $item; }\[/code\]I cant figure out why it is not working, could someone please help.The response we get back from the server that we are requesting is the followingHTTP/1.1 200 OKContent-Type: text/xml; charset=utf-8Content-Length: length\[code\]<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ProcessPaymentResponse xmlns="https://services.incard.com.au"> <ProcessPaymentResult> <ResponseCode>string</ResponseCode> <ResponseDescription>string</ResponseDescription> </ProcessPaymentResult> </ProcessPaymentResponse> </soap:Body></soap:Envelope>\[/code\]
 
Back
Top