Created
December 12, 2011 01:24
-
-
Save nicholasareed/1464055 to your computer and use it in GitHub Desktop.
PHP Sample Simple Integration
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 | |
// 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