Created
April 16, 2015 20:36
-
-
Save rzfarrell/b7ed595544a90552ae2d to your computer and use it in GitHub Desktop.
php salesource outbound message listener
This file contains hidden or 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 | |
header("Content-Type: text/xml\r\n"); | |
ob_start(); | |
// Sends SOAP response to SFDC | |
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>'; | |
} | |
// Get raw post data | |
$data = fopen('php://input', 'rb'); | |
$content = fread($data,5000); | |
//Now do what ever you will with the message in $content - you should parse it (xml) etc. | |
... | |
ob_end_clean(); | |
respond('true'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment