I'm Trying to create DeepL glossaries and found a site that takes cURL and converts it to PHP, the PHP has hard wired data which I need to replace with variables passed to the PHP via POST, how do I replace the hard wired data with the variables, this is my first PHP routine , the code is as follows:
$url = "https://api.deepl.com/v2/glossaries";
$pass_auth_key = $_POST["pass_auth_key"];
$pass_name = $_POST["pass_name"];
$target_lang = $_POST["pass_target_lang"];
$pass_entries = $_POST["pass_entries"];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Authorization: DeepL-Auth-Key .$pass_auth_key",
"Content-Type: application/x-www-form-urlencoded",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = <<<DATA
name=.$pass_name&source_lang=en&target_lang=.$target_lang&entries=.pass_entries&entries_format=tsv
DATA;
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);
?>