-
Shortening URLs from PHP with Bit.ly
28 July 2011
Read moreI've been looking around for a really simple API that would be a nice place to get started using web services from PHP - and I realised that bit.ly actually fits the bill really well. They have straightforward api docs on google code, and it's also a pretty simple function!
Here's a simple example, using PHP's curl extension, of using the bit.ly API to get a short URL, using PHP (you need an API key, but if you're a registered bit.ly user, you can log in and then find yours at http://bitly.com/a/your_api_key).
-
PHPComCon Web Services Tutorial
18 April 2011
Read moreIf you are attending my Web Services tutorial at PHP Community Conference (if not, probably nothing for you to see here) later this week then you might like to download the sample code. I'll be referring to this and inviting you to "play along" as I go creating services during …
-
Invalid Protected Resource URL in Pecl_Oauth
12 April 2011
Read moreI had a funny (funny weird, not funny haha) problem the other day when working with pecl_oauth in PHP to talk to a service. I'd gone through all the handshaking steps, got the acces token and was ready to start talking to the service itself. However when I tried to …
-
Using s3cmd To Manage Files on Amazon S3
26 January 2011
Read moreRecently I moved some podcasts on to Amazon Simple Storage Service, or S3, which I know is great and easy to use, and I've used it with some wrappers, but never directly until now. It turns out, unsurprisingly, that S3 is great and easy to use :) I used s3cmd from s3tools - a collection of python scripts that made this really really easy. Even better, I'm an Ubuntu user so s3cmd is already packaged for me and I simply installed with:
-
OAuth Google API for Unregistered Applications
17 December 2010
Read moreIt is pretty common when using OAuth for there to be a relationship between the provider and consumer; as a consumer you usually register with the provider to obtain a consumer key and consumer secret. Google's APIs however do not require this. It is recommended that you register your application …
-
Google Analytics Accounts API
23 November 2010
Read moreI'm working with Google Analytics at the moment, to pull information about web traffic from analytics into another system. Google have excellent APIs and that makes this job much easier. I'm using pecl_oauth to authenticate users against their google accounts (see my post about using OAuth from PHP), but even after I have a valid google user, working out which analytics accounts they have access to and how to refer to them is a puzzle in itself, so I thought I'd share what I learned.These examples use pecl_http, since I have control of my platform and I find it easy to work with. I've tried to write this with explanations of the overall process in between the code snippets so hopefully this makes the process clear whether or not you will use exactly the same implementation.
-
Best Practices in API Design: Audio and Slides
15 October 2010
Read moreEarlier in the year I gave a talk at PHP UK in London entitled "Best Practice for API Design". I really enjoyed giving this talk, since I work so much with APIs and enjoy sharing my ideas. The audio is now online so if you missed the talk, feel free …
-
Authenticating with OAuth from PHP
28 September 2010
Read moreI've been looking into OAuth recently and really like what I see, so I started looking at actually starting to play with something that uses it (and isn't twitter). In the pursuit of this, I spent some time walking through the process of how to actually authenticate using OAuth, as a client. I chose Yahoo!'s service, because they have some fabulous developer documentation and have a standard OAuth implementation. Although you don't strictly need any special libraries to handle OAuth, that would be a bit like decoding XML with a regex, so I used the OAuth Package from PECL. For others (including me after I've slept), here's an outline of the process.
-
Retrieving Product Attributes from Magento's V2 API
12 July 2010
Read moreI've been working with the API for Magento in recent weeks and I had a bit of a struggle explaining to the V2 API which attributes of a product I wanted to retrieve. Actually I had issues talking to the V2 API at all, but that's a different post so …
-
Accessing the Magento V2 API
24 June 2010
Read moreRecently I've been working with Magento at work, and in particular with integrating with their API. Now, before I say anything more, I must say that I am always pleased when I see that these products do include some kind of API. The Magento one is a bit interesting, although …
-
Web Services Tutorial on TechPortal
01 June 2010
Read moreI'm very pleased to say that today I have a a post about web services for PHP developers published on techPortal! OK so I edit techPortal so this is the written equivalent of introducing myself as a speaker but I enjoyed writing the post and I hope it'll be a …
-
Accessing the Magento Web API
04 May 2010
Read moreI've been working with the Magento Web API lately, and the first problem I ran into was actually getting access to it. Contrary to its reputation, I found some perfectly good documentation outlining how to connect to the service and use it. I thought I was on to a winner …
-
GETting RESTful collections - may I filter?
23 March 2010
Read moreAt work at Ibuildings recently, I've been teaching some classes on web services, and its a topic that I've spoken about once or twice at conferences. But something has always bothered me, so I find myself in the unusual position of blogging a question.
RESTful collections
So, when you are …
-
Supermondays: Recap
23 February 2010
Read moreLast night I travelled to the northeast of England to speak to a thriving technical community up there called Supermondays. They contacted me some time ago asking if I could get there to speak one Monday, and last night was the night! It was a very civilised gathering, with sandwiches …
-
PHP and JSON
10 February 2010
Read moreThis is a quick outline on working with JSON from PHP, which is actually pretty simple to do. This post has some examples on how to do it and what the results should look like. JSON stands for JavaScript Object Notation, and is widely used in many languages (not just …
-
Speaking at PHPNW February
25 January 2010
Read moreIf anyone is able to make it to the PHPNW User Group meet in Manchester next Tuesday 2nd February - I'm the speaker there! I'll be giving a talk entitled "Best Practices for Web Service Design", which covers lots of information about web services and how to write one that your …
-
Three Ways to Make a POST Request from PHP
18 January 2010
Read moreEDIT: A more modern take on this topic is here http://www.lornajane.net/posts/2018/make-a-post-request-from-php-with-guzzle
I've been doing a lot of work with services and working with them in various ways from PHP. There are a few different ways to do this, PHP has a curl extension which …
-
Add a heartbeat method to your service
28 October 2009
Read moreOver the summer months I wrote a series of posts about designing APIs in general, and web services in particular. This included posts on status codes for web services, error feedback for web services, auth mechanisms for web services, saving state in web services and using version parameters with web …
-
Adding PUT variables to Request Object in Zend Framework
17 August 2009
Read moreWhen I wrote recently about testing web services within Zend Framework, I missed out a really key piece of information! I didn't explain how I was reading the PUT vars in my controller code in the first place - so I'll rectify that omission now.
Its very simple: I have extended …
-
Using Zend_Test for Web Services
13 August 2009
Read moreRecently I had cause to develop a web service and so I wrote some tests to go along with it - or I was about to. When I looked at the asserts available in Zend_Test, they were all geared towards HTML/CSS output - but we can test just as effectively on …
-
PHPUnit with Zend_Controller_Action_Helper
23 July 2009
Read moreI'm currently working on a REST service built in Zend Framework and I ran into problems very quickly - when I tried to write the first unit test for the first action in fact! PHPUnit was just dying when I asked it to dispatch() any URL which didn't return HTML, it …
-
PUTting data fields with PHP cURL
17 July 2009
Read moreThis is a little post about how to PUT multiple data fields using the PHP cURL extension. Why I wanted to do this in the first place is beyond the scope of this post, since its quite a long story. The curl command line allows data fields to be sent …
-
Status Codes for Web Services
02 July 2009
Read moreThis the last entry in a mini series on points to consider when designing and building web services. So far there have been posts on error feedback for web services, auth mechanisms for web services, saving state in web services and using version parameters with web services.
Unlike the other …
-
Version Parameters for Web Services
30 June 2009
Read moreThis is a mini series on points to consider when designing and building web services. So far there have been posts on error feedback for web services, auth mechanisms for web services and saving state in web services.
When designing a service API, there are lots of things you can …
-
Saving State in a Web Service
23 June 2009
Read moreThis is a mini series on points to consider when designing and building web services. So far there have been posts on error feedback for web services and auth mechanisms for web services.
Web services, by their very natures, are stateless, and this is no different to any other web …
-
Architecting Web Services - FOWA Tour
29 May 2009
Read moreI spoke at the FOWA Tour event in Leeds yesterday, as their local speaker (they set aside a slot for each place they go). It was a great event, good atmosphere and I really enjoyed the both crowd and content. I can't imagine what the logistics for something like this …
-
Error Feedback for Web Services
18 May 2009
Read moreI have been thinking, writing and speaking a little bit about web services recently, starting with a few thoughts on authorisation mechanisms for services. Today we'll look at another really important aspect of authoring web services, and one feature that will definitely get used - error handling and feedback! Having clear …
-
Speaking at FOWA Tour, Leeds, May 28th
14 May 2009
Read moreI'm surprised and delighted to announce that I will be one of the speakers at the rather excellent FOWA Tour even in Leeds on 28th May (two weeks today!). The day is like a roadshow version of the famous FOWA conferences, with a morning of (free!) cloud workshops and an …
-
Auth Mechanisms for Web Services
01 May 2009
Read moreHaving been involved in quite a few service-related activities in the last year or so, I've been having a few thoughts about what I've learned from this and what decisions I make when designing a service. Hopefully there will be a few of these posts - but to start with, I'm …
-
PHP Advent Article Published
05 December 2008
Read moreI was wildly excited a few weeks ago to receive an email inviting me to be one of the contributors to this year's PHP Advent. Actually the biggest kick was seeing my name in a list of PHP luminaries! The article was published today, you can find it at http …