1
Just read a certain Curl return value. By giving the $arrData =json_decode($var);
where $var
is the return of curl_exec
Obtenho:
stdClass Object
(
[id] => PAY-A8XUTU4VSTE6
[status] => WAITING
[delayCapture] =>
[amount] => stdClass Object
(
[total] => 120
[fees] => 0
[refunds] => 0
[liquid] => 120
[currency] => BRL
)
[installmentCount] => 1
[fundingInstrument] => stdClass Object
(
[boleto] => stdClass Object
(
[expirationDate] => 2017-06-05
[lineCode] => 23793.39126 60000.105274 54001.747903 9 71810000000120
[instructionLines] => stdClass Object
(
[first] => Site
)
)
[method] => BOLETO
)
[fees] => Array
(
[0] => stdClass Object
(
[type] => TRANSACTION
[amount] => 0
)
)
[events] => Array
(
[0] => stdClass Object
(
[type] => PAYMENT.CREATED
[createdAt] => 2017-05-26T19:25:34.913-03
)
[1] => stdClass Object
(
[type] => PAYMENT.WAITING
[createdAt] => 2017-05-26T19:25:34.913-03
)
)
[receivers] => Array
(
[0] => stdClass Object
(
[moipAccount] => stdClass Object
(
[id] => MPA-**********
[login] => [email protected]
[fullname] => Fulano
)
[type] => PRIMARY
[amount] => stdClass Object
(
[total] => 120
[refunds] => 0
)
)
)
[_links] => stdClass Object
(
[self] => stdClass Object
(
[href] => https://sandbox.moip.com.br/v2/payments/PAY-A8XUTU4VSTE6
)
[order] => stdClass Object
(
[href] => https://sandbox.moip.com.br/v2/orders/ORD-SLKVC9BB5OCT
[title] => ORD-SLKVC9BB5OCT
)
[payBoleto] => stdClass Object
(
[redirectHref] => https://checkout-sandbox.moip.com.br/boleto/PAY-A8XUTU4VSTE6
)
)
[createdAt] => 2017-05-26T19:25:34.913-03
[updatedAt] => 2017-05-26T19:25:34.913-03
)
Now what I need exactly is to know how to capture a certain value within this, as an example that I tried:
echo $arrData["_links"][0]['payBoleto']['redirectHref'];
Call me back, Cannot use object of type stdClass as array
How exactly to fetch a value within this return?
Use
json_decode($var, true)
to return as array.– Inkeliz
show buddy, added the
true
and did the reading withecho $arrData["_links"]['payBoleto']['redirectHref'];
, return obtained. Do as response there to score you– sNniffer