SMSGATEWAYHUB SMS Gateway offers to enable any Website, Application or Information System with high speed, technologically advanced & secured 2-Way SMS Services. SMS Gateway Integration can be implemented via a wide range of simple, secured & flexible APIs offering a wide array of connection options viz. HTTP, SMPP, FTP, etc. We provide a comprehensive SMS Gateway API Integration document which guides you smoothly through the complete integration process and also provide additional code scripts for use with all kinds of programming interfaces.

Our SMS Gateway API can be integrated for both 1-way Automated SMS Alerts in websites, ERP, CRM, etc applications and 2-Way SMS for Information-on-Demand.




function PostRequest($url, $referer, $_data) {

// convert variables array to string:

$data = array();

while(list($n,$v) = each($_data)){

$data[] = "$n=$v";


$data = implode('&', $data);

// format --> test1=a&test2=b etc.

// parse the given URL

$url = parse_url($url);

if ($url['scheme'] != 'http') {

die('Only HTTP request are supported !');


// extract host and path:

$host = $url['host'];

$path = $url['path'];

// open a socket connection on port 80

$fp = fsockopen($host, 80);

// send the request headers:

fputs($fp, "POST $path HTTP/1.1\r\n");

fputs($fp, "Host: $host\r\n");

fputs($fp, "Referer: $referer\r\n");

fputs($fp, "Content-type: application/x-www-form


fputs($fp, "Content-length: ". strlen($data) ."


fputs($fp, "Connection: close\r\n\r\n");

fputs($fp, $data);

$result = '';

while(!feof($fp)) {

// receive the results of the request

$result .= fgets($fp, 128);


// close the socket connection:


// split the result header from the content

$result = explode("\r\n\r\n", $result, 2);

$header = isset($result[0]) ? $result[0] : '';

$content = isset($result[1]) ? $result[1] : '';

// return as array:

return array($header, $content);


$data = array(

'user' => "user",

'pwd' => "password",

'to' => "919898123456",

'sid' => "WEBSMS",

'msg' => "Test Message from API",

'fl' =>"0",

'gwid' => "2"


list($header, $content) = PostRequest(


// the url to post to

"", //

its your url



echo $content;


Please note that some of the above code has been supplied to SMSGATEWAYHUB by clients. As such, accuracy is not guaranteed by SMSGATEWAYHUB.