PHP

RECEIVE JSON DATA WITH PHP CURL

echo json_encode([   "name" => "Jon Doe",   "email" => "jon@doe.com",   "colors" => ["Red", "Green", "Blue"]  ]);

DUMMY JSON DATA

01

CURL FETCH $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "DUMMY.PHP"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch);

RECEIVE JSON DATA (A)

02

RECEIVE JSON DATA (B)

03

FETCH ERROR if (curl_errno($ch)) { echo curl_error($ch); } FETCH OK - DECODE  else { $decoded = json_decode($result, true); } CURL CLOSE curl_close($ch);