 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Lorna Mitchell's Blog: Building A RESTful PHP Server Understanding the Request
by Chris Cornutt January 19, 2012 @ 10:02:18
In this new post to her blog Lorna Mitchell starts off a new series (based on popular demand) looking at building an RESTful server in PHP. Back to basics - no framework, just PHP.
In the first part of this (probably) 3-part series, we'll begin with the basics. It might seem boring, but the most important thing to get right with REST is parsing all the various elements of the HTTP request and responding accordingly. I've put in code samples from from a small-scale toy project I created to make me think about the steps involved.
Her "basics" include:
- the routing to send everything to the main index file (a "front controller" of sorts) with the .htaccess settings included
- Handling the incoming request with a "Request" class
- Parsing the incoming parameters from the "php://input" stream
voice your opinion now!
restful rest webservice request htaccess index
Reddit.com: Should I be doing just about everything using REST?
by Chris Cornutt December 07, 2011 @ 12:41:38
In this new post to Reddit.com, the question is asked "Should I be doing just about everything using REST?" - wondering if their new applications should all sit on top of a web service for their functionality.
I'm pretty new to server-side programming, and actually started out with Python/mod-wsgi. From the ground up, mod-wsgi made a lot of sense. The server gets a request, you route the request. It feels like that's where I should start, so that's pretty much what I'm trying to create with PHP (a REST router - for learning purposes, I know frameworks exist). I'm trying to think of a situation where I wouldn't use a REST interface, but I can't seem to think of one (even for simple cases). Would it be safe to say that using REST is a pretty safe bet, most of the time?
There's some good discussion and answers to his question touching on things like Service Oriented Architectures, some implications of having a web service power an entire application (or applications) and
a few comments with some personal experience.
A comment about SOA sums it up well:
You learn to write for your platform in the way developers/partners will have to, so you produce a good quality usable API which encourages development and consumption of your platform.
voice your opinion now!
rest webservice soa architecture application backend
php|architect: Finding Exactly Where You Are
by Chris Cornutt November 11, 2011 @ 12:05:40
On the php|architect site today Chris Tankersley has a new tutorial about geocoding, Finding Exactly Where You Are - a guide to integrating the Yahoo! Placefinder service into your application.
Yahoo! PlaceFinder is a REST web service that will turn an address into the latitudinal and longitudinal coordinates in XML, JSON, or serialized PHP objects. It has a few other functions too, like finding the nearest airport, time zone, and even telephone area code. [...] PlaceFinder is a very simple REST service, so cURL is a quick and easy way to access it. There are no authentication tokens to deal with or logon procedures. Just send a GET request, and read the response.
He links you to the service to get an API key and includes a simple class (PlaceFinderAPI) that builds the GET query for you and makes the request via curl. Also included is an example showing how to find a given location (coincidentally, his location choice is the hotel where the php|tek conferences are held).
voice your opinion now!
geocode yahoo placefinder api tutorial rest webservice
Federico Cargnelutti's Blog: Building a RESTful Web API with PHP and Apify
by Chris Cornutt September 12, 2011 @ 09:10:06
Federico Cargnelutt has a new post to his blog showing you how to create a REST API for your site using the Apify (complete with a shiny new 1.0 release).
Web services are a great way to extend your web application, however, adding a web API to an existing web application can be a tedious and time-consuming task. Apify takes certain common patterns found in most web services and abstracts them so that you can quickly write web APIs without having to write too much code.
Some code snippets are included to build a simple REST service - first some examples with user handling then a more fleshed out example of a controller that lets you fetch "post" information as pulled from a model. A screencast has also been posted showing the library in action.
voice your opinion now!
webservice rest apify tutorial release screencast
IBM developerWorks: Hook into Wikipedia information using PHP and the MediaWiki API
by Chris Cornutt August 17, 2011 @ 12:16:25
On the IBM developerWorks site, there's a tutorial from Vikram Vaswani showing you how to connect to Wikipedia's API in your PHP application. It shows how to fetch, search and update entries through their backend. The tutorial's a little bit older (from May 2011) but the content is still relevant.
Wikipedia is the ultimate online encyclopedia, containing millions of entries on different aspects of human knowledge. Web application developers are able to access and search these entries through the Wikipedia API. This article introduces the Wikipedia API and demonstrates it in the context of a PHP application, explaining how to search and retrieve different elements of Wikipedia content with PHP.
He starts with a general introduction to the API including example feed results and URL request formats. From there he moves into the code - a mostly Zend Framework-driven example that uses the REST client. He shows how to make requests for categories, full-text search, grabbing raw page content and adding/editing the content of pages.
voice your opinion now!
mediawiki api rest client zendframework backend tutorial
Josh Adell's Blog: Neo4j for PHP
by Chris Cornutt June 17, 2011 @ 10:05:26
Josh Adell has written up a new post for his blog showing some of his experience connecting PHP to Neo4j, a graph database (and open source project). It helps to solve a problem of related datasets and the difficulties that traditional RDBMS have with them.
Lately, I've been playing around with the graph database Neo4j and its application to certain classes of problems. Graph databases are meant to solve problems in domains where data relationships can be multiple levels deep. [...] As you continue to add degrees, the query becomes increasingly unwieldy, harder to maintain, and less performant.
Graph databases, like Neo4j, handle these sorts of needs perfectly. There wasn't an official PHP interface for it, so he decided to create his own that worked with the REST interface the database provides. He includes a few code snippets showing how to connect and make a few requests - setting properties on objects, relating objects to one another and making queries that follow the paths from user to user and return them as a simple array.
voice your opinion now!
neo4j database graph tutorial rest relationship path
|
Community Events
Don't see your event here? Let us know!
|