Sample GP SMS API Use With PHP

Below there is a sample code of using GP SMS Api with PHP.

function send_sms($mobile_no, $text) {
//creating a soap client
$soap=new SoapClient(“SMS WSDL.wsdl”);
//setting the variables of SendSMSRequest type
“registrationID”    =>  “YOUR USER ID”,
“password”          =>  “YOUR PASSWORD”,
“sourceMsisdn”      =>  “88017********”,
“destinationMsisdn” =>  “88”.$mobile_no,
“smsPort”           =>  7424,
“msgType”           =>  4,
“charge”            =>  0.00,//If you want you can give some value, but if you are charged, I’m not responsible for that 😛
“chargedParty”      =>  “88017********”,
“contentArea”       =>  “gpgp_psms”,
“msgContent”        =>  $text,
//The request variable
//requesting now to send sms
return $response;

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>GP SMS Api Testing</title>
//calling the function
$text=”Hi people! Just testing out! :-)”;
$response=send_sms($phone_no, $text);

P.S. : If you get any SSL related error, go to your php.ini file,find out


then delete the ; from the beginning

Update : A new updated post (with updated code) in this link:


How To Make GP API Calls From Java Using Netbeans

How To Make GP API Calls From JAVA (Netbeans)

IDE : Netbeans 6.8(Will work on 6.7+ i hope)

1. First Create A New Java Desktop Application(File -> New Project -> Java -> Java Desktop Application). click next, give it a suitable name (eg Test), click finish.

Adding The WSDL:

1. Goto Save the page locally.

2. Then edit the 86th & 89th line. The new lines will be –

Line 86 :

<soap:address location=””/&gt;

Line 89 :

<soap12:address location=””/&gt;

3. Now go to Netbeans. In the Projects explorer(If you can’t find it, press Ctrl+1 or Window->Projects), select the new Project, right click it. Go to New->Other. Select Web Services from categories, select Web Service Client. Press Next. Select Local File: and set the locally saved file as the location. Click Finish

You are done adding the WSDL :-).

2. Design view will come up. Take a label from the Pallete(if you can’t find pallete you can press ctrl+shift+8 or go to Window->Pallete) and put it in the form. Then take a textfield and put it beside it. Now the view should be something like this

3. Change the jLabel1 text to “Please Enter The Mobile No: 017” and jTextField1’s Text to “xxxxxxxx”.

4. Select jTextField1, press right button, goto Events->Action->actionPerformed.

5. Write this code in the actionPerformed function:

WebServiceGPADPBizTalkLBSOrchestration service = new WebServiceGPADPBizTalkLBSOrchestration();

WebServiceGPADPBizTalkLBSOrchestrationSoap port = service.getWebServiceGPADPBizTalkLBSOrchestrationSoap();

LBSRequest req = new LBSRequest();

req.setRegistrationID(“YOUR ID”);

req.setPassword(“YOUR PASS”);


LBSResponse res = port.requestLocation(req);

String response =

“Status = ” + res.getStatus()+”\n”+

“Latitude = ” + res.getLatitude()+”\n”+

“Longitude = ” + res.getLongitude()+”\n”+

“Time = ” + res.getTimestamp()+”\n”;


JOptionPane.showMessageDialog(null, response);

6. Import these classes:





import javax.swing.JOptionPane;

7. Now execute with F6. This should show a prompt for mobile no, write it down, and press Enter.

8. Hopefully after some time you will get the result printed on console and in a dialog.

Happy coding 🙂