Reputation: 241
I'm trying to fetch some data. I'm new to this PHP thing, JSON as well. When I print, it just gives me an empty array. Since I don't get any errors, I suppose everything else is fine.
$request = new WP_Http;
$result = $request->request($url, $data = array());
$input = json_encode($request, true);
print($input);
Upvotes: 1
Views: 253
Reputation: 2949
You have to call
$input = json_encode($result, true);
instead of
$input = json_encode($request, true);
Upvotes: 3