开发者

PHP - capture SOAP response using ob_*

开发者 https://www.devze.com 2022-12-23 02:50 出处:网络
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_ functio

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
0

精彩评论

暂无评论...
验证码 换一张
取 消