Lorna Mitchell has posted the last part of her development process towards creating a sample REST server in PHP:
This is part 3 of my article about writing a restful service server. If you haven't already, you might like to read part 1 (covering the core library and grabbing the information we need from the incoming request) and part 2 (covering the service handler itself) before reading this section. This part covers the Response object that I used to return the data to the user in the correct format.
She show how she created the object to push the response back out to the client with an output() method that displays the XML response in a manually generated format.
The symfony blog points out more new functionality included in the latest version of the framework - a move towards a RESTful architecture.
Yesterday, I have committed the first slew of changes to the routing framework. Thanks to this refactoring, developers have new opportunities to customize the routing and this will allow very cool features in the very near future. But today, let's dive into the goodness of the symfony 1.2 routing framework.
He illustrates the (now built-in) routing functionality that allows you to define customized routes that can do things like pattern matching and can push the output through another external function to handle the results. He also takes a look at the sfRequestRoute component that forces the request to match the route definition
Lorna Mitchell has posted the second part of her series detailing her REST server development project (part one is here).
This is part 2 of my rest service writing article. In part 1 we saw the library which holds the functionality we will be using, and we also handled the incoming request and captured all the data we'll be using.
In this second part she gets into the details behind the handle() method of the class. It splits the URL into its parts and, based on the action requested, hands it off to the right method and calls the output() method to return to the user. Some error handling is also included (with custom exceptions).
Lorna Mitchell has started a three part series on her blog detailing the process she went through to develop a REST server in PHP.
I recently had reason to write a REST server in PHP, which was very interesting. There aren't a whole lot of resources on this topic around so I thought I'd write an outline of what I did. There is quite a lot to it so I'm publishing in multiple sections - this is part 1, which covers the central functionality and handling the incoming request.
In this first part she talks about the wrapper class she developed and includes some sample code that does the initial handling of the request (reading from php://input and passing it off to a handle() method to the taken care of).
Douglas Brown has put together an announcement for a web service he's come up with (and made available for download) to make a tag cloud out of the top keywords from your twitter feed.
The problem I was having was actually judging whether or not it would be worth my time following their tweets. I mean, I follow someone that is really respected in a certain field, only to find out that they tweet about their new puppy they just got more than anything. So I made a PHP script that generates a "Twitter Tag Cloud." Using this, you can generate your own Twitter tag cloud to put on your personal site to display the top keywords that you have been tweeting about.
You can either check out an example of the cloud through the form in the post, use his REST service to get the keywords for a user or you can download his code and try it out for yourself.
For a recent REST web service project, Lorna Mitchell had to put together a server for the remote clients to use. She started with a GET request then moved to handling a POST request then to a PUT request - that's where the difficulty came in:
PHP doesn't have a built-in way to do this, and at first I was a little confused as to how I could reach this information. It turns out that this can be read from the incoming stream to PHP, php://input.
Pulling from that stream gave her the raw data she needed (nicely urlencoded too) that she could parse out and use. She includes a simple example that has a check for the REQUEST_TYPE in the _SERVER superglobal to see how the request should be handled (PUT versus GET).
A new tutorial over on the IBM developerWorks site (from Vikram Vaswani) shows how to pull data from the Google Notebook service into your script via the service's REST API.
Google Notebook is a free service that allows users to save and share notes and Web clippings in an online journal. A REST-based API allows developers to build customized PHP applications around this service using SimpleXML. In this article, you learn how to use the API, with examples of reading notebooks and notebook contents using PHP.
His method grabs the contents of the REST request and drops them into a SimpleXML object for easy manipulation. Different kinds of requests are included - getting the list of notebooks, getting the notebook's contents and how to add on extra parameters to the REST call to get more information in the responses.
On the C7Y website, a new tutorial has been posted from Nate Abele (following his previous CakePHP-related article) covering the use of the framework to create a REST web service and manage resources inside of it.
We're going to take these concepts [from the previous article] further and add a new one: REST. In the course of this series so far, we've only been discussing how to use the Router to examine and act on different parts of a URL.
He gives a list of possible headers that could come from a client (like Accept-Charset or Content-Type) and how these can be directly pulled in to the CakePHP routing system. A few extra bits of code later and your app can be mapping requests directly to the controllers for the actions the user's requesting. All that's left is to serialize the results back into XML to echo out.
Whether you're an enterprise developer working in a large shop or setting up a blog for yourself, you've almost certainly been tasked with keeping your development code in sync with some type of stable release. Whether a project is big or small, you still need to ensure that the core code you work with remains consistent.
The tutorial walks you through the setup of a basic AIR application, how to pull the configuration XML into it and parsing it to use in the interface. The next step is the sync, grabbing your config and pushing it out to other multiple configs across your sites (via a REST service).
Korynn Bohn has posted a new tutorial/article on the Zend Developer Zone website that talks about (and advocates for) web services.
Web services are the coolest technology I know of that ends up turning everyone off. I don't know about you, but when I go to a lecture on Web services, invariably tons of acronyms come out [...] and then I start to nod off and dream about a land where free Krispy Kreme donuts grow on trees.
He reframes the web services world away from the acronyms and strict standards to more towards using it as a method of communication between apps, letting them engage in some friendly conversation. He uses the rest of the tutorial showing how to create an RSS reader of sorts using dashes of PEAR, XML, C#, XSLT, Ajax and Flex.