Is there any way to get the url of the latest version of a wordpress plugin?
Fo example the Google XML sitemaps plugin http://wordpress.org/extend/plugins/google-sitemap-generator/ currently uses th开发者_开发技巧e http://downloads.wordpress.org/plugin/google-sitemap-generator.3.2.4.zip URL but if/when a new version is out this will change to http://downloads....sitemap-generator.3.2.5.zip.
$request = new StdClass();
$request->slug = stripslashes('Akismet');
$post_data = array(
'action' => 'plugin_information',
'request' => serialize($request)
);
$options = array(
CURLOPT_URL => 'http://api.wordpress.org/plugins/info/1.0/',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post_data,
CURLOPT_RETURNTRANSFER => true
);
$handle = curl_init();
curl_setopt_array($handle, $options);
$response = curl_exec($handle);
curl_close($handle);
$plugin_info = unserialize($response);
var_dump($plugin_info->download_link);
This is the API which gets one plugin information at wordpress.org.
REF: WordPress.org Plugins API Docs
Do you mean some sort of RSS feed that automatically updates the direct link to the plugin? If so, I don't think this is possible. You can however view all the older versions of a plugin, for example: http://wordpress.org/extend/plugins/google-sitemap-generator/download/
精彩评论