Posterous API Library for PHP 5 | Calvin Freitas

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:

01<?php
02require('posterous-api.php');
03$api = new PosterousAPI();
04 
05header('Content-type: text/html');
06 
07try {
08    $xml = $api->readposts(array('hostname' =>'calvinf'));
09}
10catch(Exception $e) {
11  print $e->getMessage();
12  die;
13}
14 
15foreach($xml->{post} as $post) {
16    echo $post->title . "<br />";
17}
18?>

This is a cool php lib I found for the Posterous api.

Loading mentions Retweet
Jan 9, 2010 - Posted 1 month ago

0 comments

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    Connect    twitter