Fetching Namespaced XML Elements With SimpleXML

Recently I was working with some google APIs and needed to retrieve some namespaced elements from the result set. This confused me more than I expected it to so here’s my code for the next time I need it (and if you use it too, then great!)

I was reading from their analytics data feed API, this returns a few key fields and then multiple <entry> tags, each with namespaced children. The entry tags look something like: Continue reading

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 to have a listen. You can also see the slides (on slideshare) and also read the series of blog posts I wrote on this topic which originally inspired the talk.

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.

Continue reading