Hi, In this tutorial, I am going to explain how to integrate the SMS gateway hub API in PHP.
What is SMS gateway hub ?
SMS gateway hub is an SMS provider in India. It will allow to easily send & manage texts from PC, Web, Android, API or Excel.
First, We need to register at the https://www.smsgatewayhub.com/
SMS gateway hub offers a free trial with 20 to 40 credits for testing purpose.
Here we need to provide the original information i.e valid mobile number and email because your SMS gateway hub account username & password will be sent to the registered mobile number only.
After that, you will get a call from SMS gateway hub . They will ask you,
Do you want promotional credits or transactional credits ?
Then you will ask them to give the promotional credits, Then they will credit the 20 to 40 promotional credits to your account.
Each credit equals to one SMS
i.e 20 credits = 20 SMS
API key is found at API Documents -> API Codes
sendSMS.php
Output:
Download
What is SMS gateway hub ?
SMS gateway hub is an SMS provider in India. It will allow to easily send & manage texts from PC, Web, Android, API or Excel.
First, We need to register at the https://www.smsgatewayhub.com/
SMS gateway hub offers a free trial with 20 to 40 credits for testing purpose.
Here we need to provide the original information i.e valid mobile number and email because your SMS gateway hub account username & password will be sent to the registered mobile number only.
After that, you will get a call from SMS gateway hub . They will ask you,
Do you want promotional credits or transactional credits ?
Then you will ask them to give the promotional credits, Then they will credit the 20 to 40 promotional credits to your account.
Each credit equals to one SMS
i.e 20 credits = 20 SMS
API key is found at API Documents -> API Codes
sendSMS.php
<?php function sendSMS($mobile,$message){ $user = "YOUR-API-KEY-HERE"; $url = 'http://login.smsgatewayhub.com/api/mt/SendSMS?APIKey='.$user.'&senderid=WEBSMS&channel=INT&DCS=0&flashsms=0&number='.$mobile.'&text='.$message.'&route=16;'; $ch=curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,""); curl_setopt($ch, CURLOPT_RETURNTRANSFER,2); $data = curl_exec($ch); print($data); /* result of API call*/ } ?>Call the sendSMS function with two parameters, Those are mobile number and message.
<?php $message = rawurlencode("Your message here"); sendSMS("919XXXXXXXXX",$message); ?>Here 91 is the country code of India.
Output:
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"36049283","MessageData":[{"Number":"919XXXXXXXXX","MessageId":"NGQPxdsUL0i5gaciWDMbxQ"}]}
Download
* If you like this post please don’t forget to subscribe Techies Badi - programming blog for more useful stuff
EmoticonEmoticon