Skip to content

Instantly share code, notes, and snippets.

@allude
Last active June 29, 2016 16:35
Show Gist options
  • Save allude/aebc0b111e1751547a651ffd695f8562 to your computer and use it in GitHub Desktop.
Save allude/aebc0b111e1751547a651ffd695f8562 to your computer and use it in GitHub Desktop.
Catch Salesforce outbound message and write to file.
<?php
/* joshQ
* Crude SOAP Responder for SFDC Outbound Messages</u></span>
* THIS SOFTWARE IS PROVIDED AS IS.*/
// Get raw post data
$data = fopen('php://input', 'rb');
$content = fread($data,5000);
// Write message to file
$fh=fopen('soap.txt','a'); // change location
$stamp = "\n+++ " . date('r') . " : " . time() . " : +++\n";
fwrite($fh,$stamp);
fwrite($fh,$content);
fwrite($fh,"\n---------------------------------------------------\n");
$retVal = fclose($fh);
// Respond
if ($retVal) {
respond('true');
}else{
respond('false');
}
function respond($tf) {
print '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<Ack>' . $tf . '</Ack>
</notifications>
</soapenv:Body>
</soapenv:Envelope>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment