Read curl php result


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

$data = json_decode($result, true);
$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.


output is json so try to json_decode() again

Answered By – Rokas Lak┼ítauskas

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published