<?php
$url = 'https://fastermessage.com/api/v1/sms/balance;
$apiKey = '***************************************';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-API-KEY: " . $apiKey));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');
curl_exec($ch);
curl_close($ch);
?>
curl "https://fastermessage.com/api/v1/sms/balance" \
-X POST \
-H "x-api-key: ***************************************"
import httplib
headers = {'x-api-key': ' ***************************************'}
conn = httplib.HTTPSConnection('fastermessage.com')
conn.request('POST','/api/v1/sms/balance', headers)
res = conn.getresponse()
print(res.status, res.reason)
print(res.read())
print(res.getheaders())
const http = require('https');
const init = {
host: 'fastermessage.com',
path: '/api/v1/sms/balance,
method: 'POST',
headers: {
'x-api-key': ' ***************************************'
}
};
const callback = function(response) {
let result = Buffer.alloc(0);
response.on('data', function(chunk) {
result = Buffer.concat([result, chunk]);
});
response.on('end', function() {
// result has response body buffer
console.log(result.toString());
});
};
const req = http.request(init, callback);
req.end();