Skip to content

Instantly share code, notes, and snippets.

@akhy
Created January 23, 2011 11:46
Show Gist options
  • Save akhy/792017 to your computer and use it in GitHub Desktop.
Save akhy/792017 to your computer and use it in GitHub Desktop.
testing posterous PHP API
<?php
require('posterous-api.php');
$api = new PosterousAPI('email', 'password');
header('Content-type: text/html');
function pre_dump($var) {
echo "<pre>";
var_dump($var);
echo "</pre>";
}
try
{
$xml = $api->readposts(array('hostname' =>'akhyar'));
}
catch(Exception $e)
{
print $e->getMessage();
die;
}
foreach($xml->{post} as $post)
{
echo $post->title . "<br />";
echo $post->link . "<br />";
echo $post->author . "<br />";
echo $post->authorpic . "<br />";
echo $post->media[0]->type . "<br />";
echo $post->media[0]->medium->url . "<br />";
echo $post->media[0]->medium->filesize . "<br />";
echo $post->media[0]->medium->height . "<br />";
echo $post->media[0]->medium->width . "<br />";
echo $post->media[0]->thumb->url . "<br />";
echo $post->media[0]->thumb->filesize . "<br />";
echo $post->media[0]->thumb->height . "<br />";
echo $post->media[0]->thumb->width . "<br />";
echo $post->commentsCount . "<br />";
echo $post->comment . "<br />";
//pre_dump($post);
//break;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment