I have made a PHP script that need to receive the following XML:
<contact_email>people@example.com</contact_email>
<contact_password>hash_in_sha256</contact_password>
I usually do stuff with JSON, but in this project I need to use XML. So, to parse the JSON objects in PHP I use the following code with the following JSON:
{
"contact_email":"people@example.com",
"contact_password":"hash_in_sha256"
}
The script:
$jsonBody = file_get_contents("php://input");
$jsonBody = json_decode($jsonBody);
$contact_email = $jsonBody->contact_email;
$contact_password = $jsonBody->contact_password;
But what should I do to have "people@example.com" and "hash_in_sha256" from the XML as a variable in PHP?