Skip to content

Instantly share code, notes, and snippets.

@ejancorp
Last active November 22, 2017 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejancorp/03738f18f0b507a7906334ebb8f96981 to your computer and use it in GitHub Desktop.
Save ejancorp/03738f18f0b507a7906334ebb8f96981 to your computer and use it in GitHub Desktop.
Basic Chikka API Usage
var settings = {
"async": true,
"crossDomain": true,
"url": "https://post.chikka.com/smsapi/request",
"method": "POST",
"data": {
"message_type": "SEND",
"mobile_number": "",
"shortcode": "",
"message_id": "",
"message": "Hi Hello",
"client_id": "",
"secret_key": ""
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require("request");
var options = { method: 'POST',
url: 'https://post.chikka.com/smsapi/request',
form:
{ message_type: 'SEND',
mobile_number: '',
shortcode: '',
message_id: '',
message: 'Hi Hello',
client_id: '',
secret_key: '' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$params = array(
'message_type' => 'SEND',
'mobile_number' => '',
'shortcode' => '',
'message_id' => '',
'message' => 'Hi Hello',
'client_id' => '',
'secret_key' => '',
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://post.chikka.com/smsapi/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($params)
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment