search

Home  >  Q&A  >  body text

Read curl php results

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

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

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

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

Why can't I access the data list? I just want to do a foreach on this list, but I can't.

P粉718165540P粉718165540233 days ago414

reply all(1)I'll reply

  • P粉186904731

    P粉1869047312024-04-04 11:07:30

    The output is json, so try json_decode() again

    reply
    0
  • Cancelreply