2

basically I want to know how to receive the JSON data from IFTTT when sending a web request to a specific URL on my web server.

I know that IFTTT will send a web request with the JSON data to my .php file which is a public hosted web page (92.123.xxx.xxx:8089/MyPhpFile.php), but how would I know if that web request was actually sent or not because when I try running my PHP script on my web browser it just says nothing ie no POST data was received.

Basic Flow Of IFTTT Setup:

  1. Tell google home (google assistant) to switch TV1 to Xbox.

  2. Run WebHook Applet which sends a web request to the 92.123.xxx.xxx:8089/MyPhpFile.php using method POST, content type application/json and body {“token”:”mseries”,”command”: “{{NumberField}}”, ”test”: “data”}

  3. ???? This is where I become confused because I need to Receive JSON data and execute the proper python scripts to send telnet commands to my matrix switcher.

MyPhpFile.php

<?php
$token = "mseries";
# Capture JSON content
$input=json_decode(file_get_contents('php://input'), true);
# Check if correct TOKEN passed or else echo nothing
if($input['token'] != $token) {
  echo "nothing";
  exit;
}
switch ($input['test']) {

case 'data':
  echo print_r($data);
}
?>
S.Q
  • 155
  • 2
  • 15

0 Answers0