How to SEND/Retrieve SMS from GOIP

reiwin462 picture reiwin462 · Mar 9, 2015 · Viewed 10.6k times · Source

Is there a way for a PHP or VB.net to retrieve/send sms on GOIP (sms-gateway) without accessing it built in Web Manager?.

The said device is using UDP port 44444.

Answer

paisapimp picture paisapimp · Jan 1, 2016

This script is only to send SMS via php on a GOIP VOIP GATEWAY

<?php
$rand = rand();
$url = 'http://goip-ip-adress-here/default/en_US/sms_info.html';
$line = '1'; // sim card to use in my case #1
$telnum = '1230000000'; // phone number to send sms
$smscontent = 'this is a test sms'; //your message
$username = "admin"; //goip username
$password = "1234"; //goip password

$fields = array(
'line' => urlencode($line),
'smskey' => urlencode($rand),
'action' => urlencode('sms'),
'telnum' => urlencode($telnum),
'smscontent' => urlencode($smscontent),
'send' => urlencode('send')
);

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_PORT, 80);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//execute post
echo curl_exec($ch);
echo curl_getinfo($ch);

//close connection
curl_close($ch);
?>