Here is a solution for you:
First download this nice little class
Next, include it and “login”
<?php
require_once 'foursquare.php'; //Load the foursquare class
$foursquare = new fourSquare("username", "password"); //login
Then to get the venue’s name use:
<?php echo $foursquare->venueName; ?>
you can also get the venue’s type,venue’s icon, venue’s location on the map and user’s comment on the venue. its all documented at the link provided above.
Update:
Since FourSquare changed their API i found a much simpler solution:
login to your foursquare account and then head to http://feeds.foursquare.com/ and copy the rss feed url.
and use this:
// $numCheckins - number of checkins to get
function Display_last_checkins($numCheckins = 2){
$feedURL = 'enter your rss feed here';
$feedObject = simplexml_load_file($feedURL . '?count=" .$numCheckins);
$items = $feedObject->channel;
$checkin = $items->item;
echo "<ul>';
$count = 0;
foreach ($checkin as $item) {
if ($item->link != '') {
echo '<li><a href="'. $item->link .'">' .
$item->title . '</a><br/></li>';
/* you can use
$item->description - user comment
$item->pubDate - publish date and time (Wed, 27 Apr 11 16:40:18 +0000)
$item->georss:point - location for map (31.613221 34.76874)
*/
$count++;
if ($count == $numCheckins) {break;}
}
}
$echo .= '</ul>';
}