So, Zend_Rest_Client is not a REST client at all - it does not support PUT and DELETE methods, for example. After trying to clone it with the actual RESTful service, I got tired and wrote the correct REST client for PHP:
http://github.com/educoder/pest
It still lacks a few things, but if it is raised, I will add some more work.
Here is an example of using the OpenStreetMap REST service:
<?php /** * This PestXML usage example pulls data from the OpenStreetMap API. * (see http://wiki.openstreetmap.org/wiki/API_v0.6) **/ require_once 'PestXML.php'; $pest = new PestXML('http://api.openstreetmap.org/api/0.6'); // Retrieve map data for the University of Toronto campus $map = $pest->get('/map?bbox=-79.39997,43.65827,-79.39344,43.66903'); // Print all of the street names in the map $streets = $map->xpath('//way/tag[@k="name"]'); foreach ($streets as $s) { echo $s['v'] . "\n"; } ?>
It currently uses curl, but I can switch it to HTTP_Request or HTTP_Request2 line by line.
Update: Some people seem to have jumped on this. Pest now supports HTTP authentication and many other features thanks to GitHub contributors.
Matt Zukowski Jan 20 '11 at 17:26 2011-01-20 17:26
source share