Last active
June 29, 2016 16:35
-
-
Save allude/aebc0b111e1751547a651ffd695f8562 to your computer and use it in GitHub Desktop.
Catch Salesforce outbound message and write to file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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