2

I have a simple IFTTT recipe that triggers whenever an instagram photo is posted with the hashtag #dog (used as an example since it triggers nearly every second and makes it easy to troubleshoot). This works fine. The associated action is with Maker to submit a GET call to a website as pictured below.

enter image description here

This then runs a very simple PHP script as below.

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$dump = $conn->real_escape_string(var_export($_GET, true));
$sql = sprintf("INSERT INTO table (dump) VALUES ('%s');", $dump);
echo $sql;
if ($conn->query($sql) !== TRUE) {
    echo "#######Error: ". $conn->error ."#######<br/>";
}
$conn->close();

This should simply 'dump' the $GET array into the MySQL table. When I use the browser to run the PHP script such as

http://www.example.com?data=test&data2=testing

I get the correct response in the DB. However, when triggered through IFTTT I get an empty array.

I've tried all the options for Content Type and both POST and GET Methods but nothing is submitted either way. I have found a workaround by putting the GET call together in the URL field, BUT this isn't tidy and I figure it should work so want to understand the problem. Also, I'd like to POST rather the GET if possible.

I assume the problem to be with the Body and it not being formatted correctly, but I've tried every combination I can think of and what you see here is how the example on IFTTT is displayed.

Does anyone have any ideas or a known solution.

Thanks,

Stuart Clarke
  • 395
  • 4
  • 19

1 Answers1

0

You need to embed the data in the URL itself like you mentioned. That is how GET requests work. If you want to keep it tidy and nor embed the data in the URL, you can use $_POST in your PHP script and then use the body section in IFTTT to embed the data, as seen in the screenshot.

Ameer
  • 978
  • 4
  • 13
  • 34
  • POST is what I am after but it doesn't work (I do use $_POST for the POST example in my PHP). GET has just been my workaround for now and works well enough but it seems to me that there is a bug with IFTTT. – Stuart Clarke Jul 04 '16 at 07:43