I’ve finally taken the time to play around with Yahoo Pipes. I’ll probably do a few posts over the next couple of days on my findings, but I’ll get started with the basics on how to write a json web service in PHP that can be called from Pipes. The capability to call a web service from Pipes is a recently added addition by Yahoo that could prove to be very powerful.
There’s a good post and recipe for getting started over at echoditto labs. Unfortunately, my web host had two things that made this recipe a non-starter. First, they don’t allow compiling C++ extensions for PHP, as is required by the JSON PECL package. Second, they have PHP’s annoying little magic_quotes_gpc setting turned on.
Here’s a little recipe that may help you get started. You’ll need to first download the Services_JSON library — a proposed addition to PEAR that encodes and decodes JSON. The recipe below assumes that you use items as the input for the “Path to item list” prompt in Pipes. The recipe is simple and straightforward. It is the moral equivalent of Yahoo’s Java example — it simply appends ” (This text was added by the external Web Service)” to the title of each item in the feed. It provides one additional bit of functionality that may help you get started. It logs the decoded input value to pipes-log.txt. This will help give you an idea of what your input is.