The Latest method

The latest method gets a list of the latest posts.

Basic usage

It can be used (in the most basic manner) as follows:
<?php
$PHPingFM 
= new PHPingFM($developer_key$user_app_key);
$services $PHPingFM->latest();
// The $latest variable contains an array of the user's latest posts.
?>

Return value

It returns an array formatted in the following way:
Message ID
method
The method of posting (microblog, status, or blog)
date
rfc
Fri, 16 May 2008 19:35:02 -0500
unix
1210984502
services
machine-readable name
human-readable name
title (optional)
The title of the post
body
The body of the post
...

Example usage

As an example, let's make an un-ordered list, in the following format, containing the previous posts.
<p> <strong>Title</strong><br /> Body<br /> <small>Posted at Time on Date to Services</small> </p>

Here is the finished result:

This is yet another test post.
Posted at 10:41PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

Testing more
Posted at 10:41PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

More ! Whoohoo !
Posted at 10:40PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

More more more more
Posted at 10:39PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

More! More! They all scream!
Posted at 10:39PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

And even more
Posted at 10:38PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

Testing it some more
Posted at 10:38PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

Testing out the Custom URL service #pingfm.
Posted at 10:37PM on July 5, 2008 to Twitter, Tumblr, Plurk, Custom URL

The code behind that

This was done with just a few lines of code, like this:
<?php
$PHPingFM 
= new PHPingFM($developer_key$user_app_key);
$latest_posts $PHPingFM->latest();
$output '';
foreach (
$latest_posts as $post) {
  
$output .= '<p>';
  if (isset(
$post['title'])) {
    
$output .= '<strong>'$post['title'] .'</strong><br />';      
  }
  
$output .= $post['body'];
  
$output .= '<br /><small>Posted at 'date('g:iA'$post['date']['unix']) .' on 'date('F j, Y'$post['date']['unix']);
  
$output .= ' to 'implode(', '$post['services']) .'</small>';
  
$output .= '</p>';
}
?>

More advanced usage

The latest method also takes two optional parameters:
  • $limit - the number of posts.
  • $order - the order of the posts, DESC or ASC.

An example of that