PHP - capture SOAP response using ob_*
I'm sending a ACK response back to a SOAP request (via Salesforce) and I would like to capture what I'm sending back to SF. Now I seen some stuff online that uses ob_start (or one of the ob_ functions) to record the response but I've never used ob_ before and after Googling for a while didn't find anything I could use/follow.
The Problem: Salesforce sends an outbound message to my server via SOAP, I process the message and send back a ACK file to SF. I wan开发者_如何学Ct to log/record the message (and anything else) I'm sending back to SF. How can I do this?
Yes, anything you write to the output buffer can be captured using
ob_start();
// create and send your SOAP message
// ...
$mystring = ob_get_contents(); // retrieve all output thus far
ob_end_clean (); // stop buffering
log($mystring); // log it
echo $mystring; // now send it
精彩评论