How to pass a form variable to another page via JSON? I had create two php file with file naming page_login.php and login.php. However when running login_post.php, the $json value unable pass to login.php
page_login.php:
$email = test@gmail.com;
$password = 123;
$json = array('email' => $email, 'password' => hash("sha256",$password));
$json = json_encode($json);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://localhost/login.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close ($ch);
login.php:
$json=json_decode($_REQUEST["json"],true);
print $json;