No json_decode
-
Mistake:
Warning: json_decode() expects parameter 1 to be string
Code:
$res = json_decode($curl->post('https://auth.qiwi.com/cas/tgts', json_encode(array( 'login' => '+79999999999', 'password' => '123123' )))); $TgtTicket = $res->entity->ticket; echo $TgtTicket;
Which basically brings back the $curl-statepost... :
stdClass Object ( [entity] => stdClass Object ( [user] => +79139962423 [ticket] => TGT-391357-QO7amrRgf2kOPxhhxWdo9FZUrdIZhJLCIOQHbk6jMEjfLuSePg )
[links] => Array ( [0] => stdClass Object ( [rel] => sts [href] => https://auth.qiwi.com/cas/sts ) )
)
But json_decode can't somehow decode it, though it's all right.
-
No. That's not true.
json_decode
decode only the line, and you're sending a ready object. Something I think you have.$curl->post()
I've been decoding everything myself, and you don't have to do anything else.Completed
Looked at the source.
Curl::post()
automatically passes JSON and XML if the titleContent-Type
resembles JSON or XML (e.g. application/json or text/xml)