Get the number of popular digg posts for a URL
Sometimes, for instance when you're building a domain-info tool, you want to know the number of posts on that site that have made it to the Digg frontpage. After playing a bit, I came up with this pretty easy code:
[code language="php"]
function FrontpageDiggs($url) {
$result['source'] = "http://digg.com/rss_search?search=".$url."&area=promoted&type=url§ion=all";
$output = file_get_contents($result['source']);
preg_match_all("/.*(
$result['result'] = count($matches[1]);
return $result;
}
[/code]
Now if you echo $result['result'], you'll get the number of posts for $url that made the frontpage.
Related posts
- MSN launches Dutch Digg clone, but forgets spam prevention
- Getting Google's last visit date from the Google API
- Easily display your last Tweet
- Digg submit buttons: a good idea?
- Implementing a sitewide search function







A neat piece of code, I actually need it for a different digg-like engine (non-english), so a minor modification is to be done, but still - Thank you!.
My pleasure!