Search code examples
phpapiblogsposterous

How do I use the Posterous API for reading posts?


I want to extract the blog content from my Posterous blog using the API call of http://posterous.com/api/readposts?hostname=NAMEOFSITE

When entering the above address in a web browser, it returns the content in XML format.

What I'm stuck on is how I can use or store this content in an array so I can output it using PHP in the format that I want to display it in?


Solution

  • Use PHP's OOP SimpleXML:

    IBM Developerworks Tutorial: http://www.ibm.com/developerworks/library/x-simplexml.html

    PHP Docs: http://php.net/manual/en/book.simplexml.php

    PHP Examples: http://www.php.net/manual/en/simplexml.examples-basic.php