This website recently got a major rebuild; if you're missing something, let Lorna know.

    Tag: webservice


  1. Shortening URLs from PHP with Bit.ly


    I'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).

    Read more

  2. PHPComCon Web Services Tutorial


    If 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 …

    Read more

  3. Invalid Protected Resource URL in Pecl_Oauth


    I 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 …

    Read more

  4. Using s3cmd To Manage Files on Amazon S3


    Recently 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:

    Read more

  5. OAuth Google API for Unregistered Applications


    It 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 …

    Read more

  6. Google Analytics Accounts API


    I'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.

    Read more

  7. Best Practices in API Design: Audio and Slides


    Earlier 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 …

    Read more

  8. Authenticating with OAuth from PHP


    I'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.

    Read more

  9. Retrieving Product Attributes from Magento's V2 API


    I'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 …

    Read more

  10. Accessing the Magento V2 API


    Recently 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 …

    Read more

  11. Web Services Tutorial on TechPortal


    I'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 …

    Read more

  12. Accessing the Magento Web API


    I'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 …

    Read more

  13. GETting RESTful collections - may I filter?


    At 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 …

    Read more

  14. Supermondays: Recap


    Last 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 …

    Read more

  15. PHP and JSON


    This 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 …

    Read more

  16. Speaking at PHPNW February


    If 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 …

    Read more

  17. Three Ways to Make a POST Request from PHP


    EDIT: 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 …

    Read more

  18. Add a heartbeat method to your service


    Over 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 …

    Read more

  19. Adding PUT variables to Request Object in Zend Framework


    When 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 …

    Read more

  20. Using Zend_Test for Web Services


    Recently 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 …

    Read more

  21. PHPUnit with Zend_Controller_Action_Helper


    I'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 …

    Read more

  22. PUTting data fields with PHP cURL


    This 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 …

    Read more

  23. Status Codes for Web Services


    This 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 …

    Read more

  24. Version Parameters for Web Services


    This 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 …

    Read more

  25. Saving State in a Web Service


    This 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 …

    Read more

  26. Architecting Web Services - FOWA Tour


    I 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 …

    Read more

  27. Error Feedback for Web Services


    I 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 …

    Read more

  28. Speaking at FOWA Tour, Leeds, May 28th


    I'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 …

    Read more

  29. Auth Mechanisms for Web Services


    Having 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 …

    Read more

  30. PHP Advent Article Published


    I 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 …

    Read more