Here is a function to fetch the data, it takes a plugin_slug (like akismet) as input:
function get_todays_downloads($url$plugin_slug){
$downloads_today="?";
$url="http://wordpress.org/extend/plugins/".$plugin_slug."/stats/";
// fetch the html page:
//
$response = wp_remote_get( $url );
if( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
//echo "Something went wrong:". $error_message;
// let's show "error" if we have problems fetching the page:
//
$downloads_today="error";
} else {
// get the body of the page:
//
$html=$response['body'];
// let's strip out the newlines and tabs:
//
$html=str_replace("\n","",$html);
$html=str_replace("\t","",$html);
// let's find this type of html string:
// Today</th><td>12</td></tr>
//
preg_match('/Today<\/th><td>([0-9,]+)<\/td><\/tr>/i', $html, $matches);
// check if we got a match:
//
if(isset($matches[1])){
$downloads_today=$matches[1];
}
}
return $downloads_today;
}
// let's find out how many times the Akismet plugin has been downloaded today
//
$url="http://wordpress.org/extend/plugins/akismet/stats/";
echo "Downloads today: ".get_todays_downloads($url'akismet');