Posterous API Library for PHP 5
Current Version: 0.1
Code Available on GitHub
Public Clone URL: git://github.com/calvinf/posterous-api-library-php.git
I have written a PHP 5 library for the Posterous API. It uses the curl extension to query the Posterous API, retrieves the XML, and returns the XML as a SimpleXMLElement.
I have tested all of the Reading, Posting, and Post.ly methods. I have not done tests of the Twitter/media upload methods.
I am making a Posterous Headlines for WordPress plugin. It is currently available via GitHub, and it will be added to the WordPress plugins directory after additional testing.
Some methods require passing the username and password for a Posterous account to the constructor.
Example:
<?php
require('posterous-api.php');
$api = new PosterousAPI();
header('Content-type: text/html');
try {
$xml = $api->readposts(array('hostname' =>'calvinf'));
}
catch(Exception $e) {
print $e->getMessage();
die;
}
foreach($xml->{post} as $post) {
echo $post->title . "<br />";
}
?>






