简体   繁体   中英

Process cXML POST data in PHP

Building a punchout system and the data supplied by POST is cXML. What is the best way to process through the cXML data?

I am trying to pull out certain values (username, password etc) and am generating an XML file to return to the supplier.

I have the second part done but it's the handling of the POST that has me stuck. I have been banging my head trying to get $_POST to convert the data back into cXML.

Once I have the data in I can process it:

$senderIdentity = $xml->Header->Sender->Credential->Identity;
$senderSharedSecret = $xml->Header->Sender->Credential->SharedSecret;
$buyerCookie = $xml->Request->PunchOutSetupRequest->BuyerCookie;
$requestURL = $xml->Request->PunchOutSetupRequest->BrowserFormPost->URL;
$payloadID = $xml->attributes()->payloadID;

It's just the initial pull in that I can't get correct.

Eventually this will be put onto a HTTPS if that has any influence.

Any help would be appreciated.

regards, Robert

I got this sorted using:

file_get_contents('php://input')

And then using simplexml_load_string based on the input received.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM