<?php
$url = "https://myastrologyapi.com/v2/match_ml/";
$userid = $_POST['clientid'];
$token = $_POST['apikey'];
$headers = array(
'Method: GET',
'Authorization: Basic '. base64_encode($userid.':'.$token)
);
$curl = curl_init();
$fields = [
"m_date" => $_POST["m_date"],
"m_time" => $_POST["m_time"],
"m_long" => $_POST["m_long"],
"m_lat" => $_POST["m_lat"],
"m_tzone" => $_POST["m_tzone"],
"f_date" => $_POST["f_date"],
"f_time" => $_POST["f_time"],
"f_long" => $_POST["f_long"],
"f_lat" => $_POST["f_lat"],
"f_tzone" => $_POST["f_tzone"],
"lang" => $_POST["lang"],
];
$fields_string = http_build_query($fields);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
$data = json_decode($response);
?>