Reply
Highlighted
Member
Posts: 3
Registered: ‎09-17-2015

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

Highlighted
Administrator Administrator
Administrator
Posts: 563
Registered: ‎08-03-2011

Re: Problems with createCustomerProfileFromTransactionRequest response with PHP

 

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

Highlighted
Member
Posts: 3
Registered: ‎09-17-2015

Re: Problems with createCustomerProfileFromTransactionRequest response with PHP

It took Eight days to get a response.

 

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

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Problems with createCustomerProfileFromTransactionRequest response with PHP

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. "