cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with createCustomerProfileFromTransactionRequest response with PHP

I can't read the XML response when using createCustomerProfileFromTransactionRequest

 

My Code . . .

 

    $content_Create_CIM =
                            "<?xml version=\"1.0\" encoding=\"utf-8\"?>".
                            "<createCustomerProfileFromTransactionRequest xmlns=\"AnetApi/xml/v1/schema/".
                            "AnetApiSchema.xsd\">".
                            "<merchantAuthentication>".
                            "<name>". $loginname . "</name>".
                            "<transactionKey>" . $transactionkey . "</transactionKey>".
                            "</merchantAuthentication>".
                            "<transId>" . $transID . "</transId>".
                            "</createCustomerProfileFromTransactionRequest>";


                            $response = send_request_via_curl($host,$path,$content_Create_CIM);

 

 

 

The CIM profile is created but I can't parse the response.

 

When I try . . .

 

$xml=simplexml_load_string($response);

 

I get  . . .

 

Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in /home/XXXXXXXX on line 99 Warning: simplexml_load_string(): HTTP/1.1 200 OK in /home/XXXXXXXX on line 99 Warning: simplexml_load_string(): ^ in /home/XXXXXXXX on line 99

 

 

What simple function can I use to parse this?

 

Thank you

Jim88763563
Member
3 REPLIES 3

 

Hi Jim88763563,

 

This is only a warning and a known issue with the PHP simpleXML library reads XML from a Microsoft server. The easiest way to directly address this is simply to suppress warnings when parsing the XML.

 

$xml = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOWARNING);

 

Thanks,

Joy

Joy
Administrator Administrator
Administrator

It took Eight days to get a response.

 

Is this normally how long it takes to get back to a customer?

This is a public forum and that not really a authorize.net issue but "known issue with the PHP simpleXML library reads XML from a Microsoft server. "