Skip to content

Instantly share code, notes, and snippets.

@allvee
Created April 3, 2017 06:58
Show Gist options
  • Select an option

  • Save allvee/c53c84a243967b259f27453be5e1cf24 to your computer and use it in GitHub Desktop.

Select an option

Save allvee/c53c84a243967b259f27453be5e1cf24 to your computer and use it in GitHub Desktop.
<?php
$msisdn = substr($_REQUEST['msisdn'], -10);
$msg = $_REQUEST['msg'];
$userMessage=explode(" ",$msg);
$keyword=$userMessage[0];
$merchantUserName=$userMessage[1];
$password=$userMessage[2];
$couponCode=$userMessage[3];
$arr_fields = array(
'request_type' => $keyword,
'mobile_no' => $msisdn,
'coupon_code' => $couponCode,
'username' => $merchantUserName,
'password' => $password,
);
$json_encoded_fields = json_encode($arr_fields);
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => "http://boupon.com.bd/api/rest/merchantsms",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')),
CURLOPT_POSTFIELDS => $json_encoded_fields
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
/*echo "Result-<br/>";*/
print_r($result);
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment