WordPress.org

Make WordPress Core

Ticket #19983: worpdress_plugin_api_bug.php

File worpdress_plugin_api_bug.php, 1022 bytes (added by plugpress, 2 years ago)
Line 
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
42var_dump($data);