json - multidimensional key-pair array with json_decode (Clickbank IPN v.6.0) -



json - multidimensional key-pair array with json_decode (Clickbank IPN v.6.0) -

this illustration of instant payment notification (ipn) receive clickbank:

$decrypted = {"transactiontime":"2014-10-06t14:49:00-07:00","receipt":"********","transactiontype":"test","vendor":"comclub","role":"vendor","totalaccountamount":1.00,"paymentmethod":"visa","totalorderamount":1.00,"totaltaxamount":0.00,"totalshippingamount":0.00,"currency":"usd","lineitems":[{"itemno":"1","producttitle":"a passed in title","shippable":false,"recurring":false,"accountamount":1.00}],"customer":{"shipping":{"firstname":"test","lastname":"user","fullname":"test user","email":"testuser@somesite.com","address":{}},"billing":{"firstname":"test","lastname":"user","fullname":"test user","email":"testuser@somesite.com","address":{}}},"version":6.0,"attemptcount":1}

so $order = json_decode($decrypted);

now want individual variables out.

at first, works fine. example, can

$transactiontime = $order->transactiontime;

but when 2nd-level stuff lineitems, i'm @ loss.

i've tried kinds of things:

$itemno = $order['lineitems']['itemno']; $itemno = $order['lineitems']->itemno; $lineitems = $order['lineitems']; $itemno = $lineitems['itemno'];

but nil seems work.

i've tried

$order = json_decode($decrypted, true);

but didn't work either

does know how itemno variable example?

thanks

you've decoded json object, you'll need treat one.

to access lineitems, you'll need $order->lineitems. should note lineitems array of objects , handle accordingly. illustration $order->lineitems[0]->itemno.

here's demo.

in future, utilize var_dump if you're unsure of object or array's structure. help tremendously.

json multidimensional-array clickbank

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -