Ping a url or script using IFTTT (with no repercussions)

Update: This actually doesn’t work as I’d hoped. Because flickr reports an error each time, eventually IFTTT disables the recipe after a few hours of calls. Back to the drawing board.

I’ve been trying to get IFTTT (if this then that) to send a call to a php script file when a trigger goes off for months. The problem wasn’t getting it to work in the first place, but for it not to leave any artifacts hanging around, or repercussions as I call them. I wanted the script to be triggered and that to be the end of it, with no files being created or errors being recorded.

An example of the problem would be the IFTTT Google Docs channel. You can upload a file to google docs from a url. You can define that url to be your php script and then tell your script to return a 404 (after it’s done its coding goodness) but when you view Google Docs a new file has still been created. If you want to use this for a large number of pings, you’re going to end up with a folder full of pointless files and a waste of your disc space. The Evernote and WordPress channels are a similar story. Even when you attempt to fail the call to your url (with a 404 or 503) they still create a note or post.

After plenty of trial and error I finally came up with the solution. In my case the IFTTT recipe is listening out for a Twitter search, but the trigger is not what matters and you can have that set to whatever you like. It’s the action that I’ll tell you about.

Flickr is a winner here. The Flickr upload from url action to be exact.

My php script ( you can use any server language that can return a fake txt file ) does the stuff I need it to do and then I use the following lines to pretend I’m returning a text file…

header('HTTP/1.1 200 OK');
header('Content-type: text/plain');
header('Content-disposition: attachment; filename=to-delete.txt');
echo date("l");

IFTTT seems happy about this, but Flickr doesn’t like it and fails to create an image file in your photo stream. Just what we want. Our script gets called, but we don’t have to deal with files or errors anywhere, no matter how many times the trigger fires.

So from start to finish…

* Add the flickr channel to your IFTTT. You may need to create a flickr account if you don’t have one yet.
* Create a new recipe with your chosen trigger.
* Add the flick ‘upload public photo from url’ action as the output
* Set the photo url to be the url to your script
* Set the title to be anything you like. ‘blah’ for example.
* Save the recipe

You should now have IFTTT pinging your script each time your selected trigger fires. You can even choose which data to send to it from the trigger in the url using IFTTT ingredients.

One comment.

  1. HI, i use the same method, but having problems with whitespaces.
    I use lastfm scrobble trigger, do pull my track plaing with i tunes in a database.
    but everytime i call my php script only the first letters of the artist came in … or if its a band with only one word, my script getting the first part of the trackname.
    have you any workaround?