Learning from masters
Learning from masters

Reputation: 2782

Read curl php result

I'm doing a curl and getting the JSON result as:

$data = json_decode($result, true);
var_dump($data);
$data = $data["data"];
echo $data;

However, the echo of $data is "{". If I do a var_dump before assigning again the variable I see:

string(727796) "{"data":["base64_image1", "base64_image2",... ]}"

Why am I not able to access the data list? I just want to do a foreach over this list, but I cannot.

Upvotes: 2

Views: 54

Answers (1)

Rokas Lakštauskas
Rokas Lakštauskas

Reputation: 1228

output is json so try to json_decode() again

Upvotes: 1

Related Questions