Jump to content

API little problem


sevastian25

Recommended Posts

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.

Edited by sevastian25
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.