Yahoo Pipes' Web Service Module and PHP

Tom's picture
Tags: 

I'm a little shocked to see that we haven't talked about Yahoo Pipes around these parts. It's an awfully cool service, and one that we use around the office for various non-mission-critical functions — getting larger photos from a Flickr stream for display on the monitors in the lobby, for one thing.

For those unaware, Pipes lets you mix, translate, annotate and otherwise alchemically modify feeds of all sorts. Want to add a (possibly) relevant photo to each entry on your blog? Or only get posts from a particular author on a group blog? Or get filtered Craiglist real estate listings translated into German and sent to your mobile phone? Pipes can do all of this, and does so via a terminally-slick GUI.

But recently a friend tipped me off to Pipes' most significant capability. The folks at Yahoo! have unveiled the Holy Grail of feed-manipulation components: a JSON-powered interface to external web services. If Pipes doesn't offer some functionality you need, you can now write a web service that does and connect it to the system.

Their example code is in Java, but it didn't take much effort for me to get one working in PHP. Just install the JSON PECL Package and use code like the following:

<?php
dl('json.so');

$json = json_decode($_POST['data']);
for($i=0;$i<sizeof($json->items);$i++)
        $json->items[$i]->description = strtoupper($json->items[$i]->description);

header('Content-Type: application/json');
print json_encode($json);
?>

This not-quite-incredibly-useful web service simply takes a JSON POST from Pipes and makes the entry bodies all capital letters. You can see some sample output (using this blog's feed) here. You'll also want to have a look at the pipe itself — the "path to item list" parameter to the Web Service object isn't totally intuitive, but is essential to getting the module to work properly.

Like I said, this isn't a very useful Pipe. But hopefully the general recipe will come in handy for someone for whom Yahoo's Java example looks like gibberish. And perhaps we'll be able to hook Pipes up to something more useful soon...

Residences can be classified

Residences can be classified by if and how they are connected to neighboring residences and land. Different types of housing tenure can be used for the same physical type

himm i am now test it..

himm i am now test it..

ohh superr superr i find

ohh superr superr i find nowwww. Thank you my friend good working..

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode>
  • Lines and paragraphs break automatically.
  • You may post block code using <blockcode [type="language"]>...</blockcode> tags. You may also post inline code using <code [type="language"]>...</code> tags.

More information about formatting options

Captcha
Are you a robot? We usually like robots, but not in our comments.
Copy the characters (respecting upper/lower case) from the image.