0

I'm wondering if anybody can help me put the below curl response into PHP variables.

enter image description here

If possible, i'd like to extract each of the goods_id and goods_descriptions.

Thanks in advance.

1
  • The response is in JSON format. You should try the json_decode() method and if you have specific issues edit your post to show example. php.net/manual/en/function.json-decode.php Commented Jun 21, 2021 at 20:48

1 Answer 1

2

What you need is json_decode()

$data = json_decode ($result); echo $data->result->goods[0]->goods_id; 

Or, if you prefer associative arrays:

$data = json_decode ($result, true); echo $data['result']['goods'][0]['goods_id']; 

PHP.net documentation on json_decode

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.