Example PHP Script to Receive and Return JSON Data

Posted on August 31, 2020 at 12:05 pm

Here is an example PHP script used to receive and return JSON data:

@header('Content-Type: application/json; charset=utf-8');
 
$json = file_get_contents('php://input');
 
$array = json_decode($json, true);
 
$username = $array['username'];
 
$password = $array['password'];
 
$result = array();
 
$result['status'] = "OK";
 
echo json_encode($result);

Receive updates via email

Other Posts

Updated Posts