Skip to content

Instantly share code, notes, and snippets.

@rzfarrell
Created April 16, 2015 20:36
Show Gist options
  • Save rzfarrell/b7ed595544a90552ae2d to your computer and use it in GitHub Desktop.
Save rzfarrell/b7ed595544a90552ae2d to your computer and use it in GitHub Desktop.
php salesource outbound message listener
<?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