NetPing server room environmental monitoring solutions and IP power distribution units.
Copyright © NetPing east Co., Ltd / E-mail:
/ Phone: +886-2-23121582
support@netpingdevice.com www.netpingdevice.com
Based on the above description, a command for sending a random SMS using the utility
is:
snmpset.exe
4. After a command is successfully executed, the next response should be received:
SENDING SMS MESSAGES VIA THIRD-PARTY WEB-APPLICATIONS (HTTP API)
Example of Sending a Random SMS Using a JavaScript Code
To send an SMS through a third-party web applications, there is a need to use the next JavaScript code:
where:
192.168.0.100 – is a default IP address of a device.
visor – is a default username for connecting to a device web interface.
ping – is a default password for connecting to a device web interface.
It is possible to send an SMS to several destination numbers, having indicated them in square brackets separated by a comma without spaces. If
destination numbers are not chosen, an SMS will go to the numbers programmed in the settings of SMS notifications.
If a format for data is correct, then the next JavaScript code is returned as a result:
A result of sending a message does not influence a returned CGI (
) response. CGI only initiates sending a message.
Example of Sending a Random SMS Using a PowerShell Script
To send an SMS through a third-party web applications, there is a need to use the next PowerShell script:
C:\Program Files (x86)\net-snmp\usr\bin>snmpset.exe -v 1 -c SWITCH 192.168.0.100 .1.3.6.1.4.1.25728.3800.1.9.0 s "[+79130000000]
Hello! Test SMS!"
SNMPv2-SMI::enterprises.25728.3800.1.9.0 = STRING: "[+79130000000] Hello! Test SMS!"
A maximum length of random SMS messages must not exceed 140 Latin characters or 70 Cyrillic characters. If there are both Latin and
Cyrillic characters in the body of the SMS, then a length of such SMS message cannot exceed 70 characters.
var r = new XMLHttpRequest();
r.open('POST', '
', true, 'visor', 'ping'); // visor:ping – username and password
http://192.168.0.100/sendsms.cgi
r.withCredentials = true;
r.send('[+79130000000] Houston, we have a problem!');
sendsms_result('ok');
$url = "
"
http://192.168.137.100/sendsms.cgi
$username = "visor"
$password = "ping"
$reqBody = "[0953345975] Тест NetPing!"
$req = [System.Net.WebRequest]::Create($url)
$req.Method = "POST";
$req.Credentials = new-object System.Net.NetworkCredential($username, $password)
$Body = [System.Text.Encoding]::UTF8.GetBytes($reqBody);
$stream = $req.GetRequestStream();
$stream.Write($Body, 0, $Body.Length);
$stream.Flush();
$stream.Close();
$resp = $req.GetResponse().GetResponseStream()
$resp.Close()