So i have this API and i got a new file in my directory for it called "mylittleapi.php"
<?php
$curl = curl_init();
$coupon_code = '****-6dcf-****-4d05-bd68-****-****-****';
$data = json_encode(array(
'coupon_code' => $coupon_code,
'receiver_id64' => '76561************'
));
curl_setopt_array($curl, array(
CURLOPT_URL => "https://theirwebsite.com/api/v1/money/coupon/redeem",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"authorization: Basic *******************************************************************=",
"cache-control: no-cache",
"content-type: application/json",
"postman-token: ********-****-****-****-************"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
when i access it through www.mywebsite.com/mylittleapi.php it does execute but what i want to do is set the coupon_code as a variable which users can just enter their own coupons and set the Textbox and submit button in another page ex: "www.mywebsite.com/redeem"
I just need to make the variable for the coupon_code, link it to my textbox and button in the other page. Can somebody help me out please ? i really need this to be done.