Skip to content

Instantly share code, notes, and snippets.

@caviv
Last active October 28, 2017 20:39
Show Gist options
  • Save caviv/6e674a5e6f896edd14f5b7bae192b77c to your computer and use it in GitHub Desktop.
Save caviv/6e674a5e6f896edd14f5b7bae192b77c to your computer and use it in GitHub Desktop.
A https://www.email2json.net sample receiving call of webhook
<?php
// receieving webhook sample
// example of receiver for email API webhook of https://www.email2json.net
// this will be called when an email is sent to webhook created in email2json.net
$date = date('Y-m-d H:i:s');
$ip = $_SERVER['REMOTE_ADDR'];
$get = json_encode($_GET);
$post = file_get_contents('php://input');
$mail = json_decode($post);
$post_data = print_r($mail, true);
file_put_contents('webh.log', "\r\n$date,$ip,$get\r\n$post_data\r\n\r\n", FILE_APPEND);
echo "OK";
@caviv
Copy link
Author

caviv commented Oct 28, 2017

this will be called when an email is sent to webhook created in https://www.email2json.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment