I have written some code into a plugin for Wordpress that when the User hits the submit button their information is stored in the WP database and is also sent to a third party website with their email and password using JSON protocalls.
this is the code I use:
$url = "https://api.example.com/v1/logins";
$data = array(
'email' => $_POST['$bemail'],
'password' => $_POST['$password'],
);
$content = json_encode($data);
$curl = curl_init($url);
$apikey = "xxxx";
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'example.com-Api-Key: ' . $apikey,
'Accept: application/json',
));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
I get an error with a response from the 3rd party website with something like:
"error: email and password caot be blank"
which tells me that the email and password is not being sent.
what am I missing here?
Thank you.
