Motyar

@motyar

Freelance Web Developer

Static Web Hosting, made easy

Feb 8, 2013

Hacking IFTTT

I hope you all know about IFTTT (if this, then that), Using IFTTT you can automate few Actions when Triggers fire on Channels.

But everything have its limits so IFTTT has them too, In this post I will try to explain how I tried to expand its limits.

Here is on example Recipes.

If I like an image post on Tumblr, put image in Dropbox


What the hack here

The problem with "New like on tumblr" doesnt provide image url, but it provides the "Post URL". I am using this script to get "Image url" using "Post url" and script (tumb.php) redirects to the image link.
Using "http://motyar.info/tumb.php?u={{Url}}" as file url.

Code


function getImg($postUrl){
 $url = explode("/", $postUrl);
 $data = file_get_contents("htt"."p://".$url[2]."/mobile/post/".$url[4]);
 preg_match_all('<a href="(.*?)">',$data,$matches,PREG_PATTERN_ORDER);
 return $matches[1][0];
}
$imgUrl = getImg($_GET['u']);
header("Location:".$imgUrl);



What is possible?

There are a lot of possibilities, You just have to process the available input to generate the required output.

Happy hacking.

Labels: , , ,




By :