 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Lorna Mitchell's Blog: Building A RESTful PHP Server Routing the Request
by Chris Cornutt January 23, 2012 @ 11:14:11
Lorna Mitchell is back with a second installment in her "Building a RESTful PHP Server" series with this new post about handling and routing the incoming requests. (You can find the first part about working with the request here)
This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.
She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction"
methods for responding to GET and POST requests.
voice your opinion now!
restful server tutorial request routing controller get post action
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
XPertDeveloper.com: Get Facebook Page Detail Using Graph API and PHP
by Chris Cornutt January 03, 2012 @ 11:06:04
New from the XPertDeveloper.com blog there's a tutorial showing how to use the Facebook graph API to get page details via a simple cURL request (cURL PHP support required for the example).
Here is the technique to get the detail of the Facebook page with Graph API and PHP. This is the very easy method to get the Facebook page detail. So Let's see how to get this done. With this method you can get details of any Facebook page [inluding] name, picture, link, website, products, description and if the user can post to it.
The sample code is only a few lines - it uses the Facebook page ID (easy to grab from the URL) and fetches a URL with it as a parameter. The output is returned as a standard PHP object with all of the properties attached (decoded from JSON). This is just one of many methods the Facebook graph API has, so check out their documentation for more methods and details on returned values.
voice your opinion now!
facebook graph api curl request tutorial
PHPClasses.org: Can .NET make PHP run faster than the official PHP implementation?
by Chris Cornutt December 15, 2011 @ 09:03:31
On the PHPClasses blog today the question is posed "can .NET make PHP run faster than the official PHP implementation?" (relating to the use of the Phalanger tool to compile PHP down to .NET assemblies.
Recently Phalanger 3.0 was released introducing numerous improvements in terms of compatibility with the PHP 5.3, interoperability with .NET platform implementations including Mono on Linux, and probably most importantly performance improvements. [...] What motivated this article was that a PHP developer named Rasmus Schultz went on the php.internals mailing list and proposed to switch the official PHP implementation based on Zend for another based on Phalanger.
The post includes some benchmarking results of requests made to a WordPress instance running on various PHP platforms. The Phalanger version came in around 2 seconds faster (average, obviously) than the PHP FastCGI setup. Also included are two suggestions for future PHP versions (v6 anyone?) that could help the language perform even better: Thread-safety for running with less memory waste and the inclusion of a JIT (Just in time compiler - of which a few are mentioned specifically.
voice your opinion now!
dotnet faster request benchmark official phalanger
Matthew Wells' Blog: Kohana and Gearman - Practical Multitasking
by Chris Cornutt August 30, 2011 @ 11:39:11
Matthew Wells has a new post that looks at combining Kohana and Gearman to create a system to handle large data processing without slowing down the rest of the application.
A commonly identified bottleneck arises when dealing with large, 'expensive' data. This is commonly seen when an application posts a large volume of well structured data to the API (that some process must be carried out upon), before some form of structured receipt is then returned as a request response. [...] Analysing such a request tends to show high PHP CPU usage with lower database consumption. [...] The structured nature of data exchanged via an API means that we can, relatively simply and reliably, divide the submitted data and process it simultaneously with the help of a great tool called Gearman.
He walks you through the entire process including his initial thoughts on what the system should be and how it should behave when the requests are made. He shares the code he used to implement the system - a simple worker that processes part of the request and returns the results. The command-line calls to run the worker manually for testing are also included.
voice your opinion now!
multitask gearman kohana worker process api request
|
Community Events
Don't see your event here? Let us know!
|