1 | <?php |
---|
2 | // |
---|
3 | // Plugin API bug |
---|
4 | // |
---|
5 | |
---|
6 | $page = 307; // Note that this number may need to be incremented as new plugins are submitted. |
---|
7 | |
---|
8 | |
---|
9 | //****************************************************************** |
---|
10 | $url = 'http://api.wordpress.org/plugins/info/1.0/'; |
---|
11 | |
---|
12 | // Get plugins by last updated |
---|
13 | $params = new stdClass; |
---|
14 | $params->page = $page; |
---|
15 | $params->per_page = 50; |
---|
16 | $params->browse = 'updated'; |
---|
17 | $params->fields = $fields = array('sections' => true); // Commenting this line makes it work. |
---|
18 | |
---|
19 | // Build post parameters |
---|
20 | $postdata = http_build_query( |
---|
21 | array( |
---|
22 | 'action' => 'query_plugins', |
---|
23 | 'request' => serialize($params) |
---|
24 | ) |
---|
25 | ); |
---|
26 | |
---|
27 | // Options array |
---|
28 | $opts = array( |
---|
29 | 'http' => array( |
---|
30 | 'method' => 'POST', |
---|
31 | 'header' => 'Content-type: application/x-www-form-urlencoded', |
---|
32 | 'content' => $postdata |
---|
33 | ) |
---|
34 | ); |
---|
35 | |
---|
36 | // Getting request results |
---|
37 | $context = stream_context_create($opts); |
---|
38 | $data = @file_get_contents($url, false, $context); |
---|
39 | |
---|
40 | |
---|
41 | // Output content |
---|
42 | var_dump($data); |
---|