Skip to content

Instantly share code, notes, and snippets.

@nicholasareed
Created December 12, 2011 01:24
Show Gist options
  • Save nicholasareed/1464055 to your computer and use it in GitHub Desktop.
Save nicholasareed/1464055 to your computer and use it in GitHub Desktop.
PHP Sample Simple Integration
<?php
// Do Authentication
// - see Important Notes in Docs
// Get raw POST data
$raw_post = @file_get_contents('php://input');
// json_decode into an Array
$details = json_decode($raw_post);
// Get the sender's email address from the POST
$from_address = $details->from_address;
// Create a Dictionary/Array with 'hello' as the key
// - normally you would get data from your database and return something useful about this person
$arr = array('hello' => $from_address);
// Set the header
header('Content-Type: application/json');
// json_encode the Array and Echo it out
echo json_encode($arr);
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment