How get response from podio api in format json or array but not object? I use podio-php ( https://github.com/podio/podio-php )
My Code
Podio::setup(CLIENT_ID_PODIO, CLIENT_SECRET_PODIO);
$oauth = Podio::is_authenticated();
Podio::authenticate_with_app(111111,
'bergbttyjra74d5afgrfhgrh781e70');
//$items = PodioItem::filter(111111);
$item = PodioItem::filter(111111, array(
'filters' => array(
'created_on' => array(
"from" => "2017-10-09 00:00:00",
"to" => "2017-10-19 23:59:59"
)
),
));
// print_r($item);// output object
// how next ?
Let's assume you really need a JSON or array for some other reasons than "I don't know what to do with an object" . So for JSON just use the as_json()
function. And to get an array just typecast an object .
So:
$json = $item->as_json(); // converts to json
$array = (array) $item; // converts to array
But @ceejayoz is right in the comments above: object itself is fine, just RTFM :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.