Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sends an email with the data that is sent to it from rest api
- // takes all incoming POST data and sends it to email
- <?php
- // this is how to respond to a post request
- // we are sending the response array to the request
- $youremailaddress = "************";
- $response = $_POST;
- foreach ($_POST as $key => $value){
- $message .= htmlspecialchars($key)." \t\t\t ".htmlspecialchars($value)."\n";
- }
- mail($youremailaddress , 'sghting', $message);
- Header("Content-Type: application/json;charset=UTF-8");
- $data = json_encode($response);
- $len = strlen($data);
- // Some browser/proxy/load balancer may get better performance if the
- // length is known beforehand. This also disables Chunked-Encoding, which
- // in some scenarios may give problems.
- Header("Content-Length: {$len}");
- die($data);
- $doubletest = " ";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment