This PHP script contains a function called SendOTA.
The function definition for SendOTA contains the following parameters:
function SendOTA ($host, $port, $username, $password, $phoneNoRecip, $otafilename, $otapin, $otapintype)
$host – IP address or host name of the NowSMS server
$port – “Port number for the web interface” of the NowSMS Server
$username – “SMS Users” account on the NowSMS server
$password – Password defined for the “SMS Users” account on the NowSMS Server
$phoneNoRecip – One or more phone numbers (comma delimited) to receive the text message
$otafilename – File name of a local file containing the XML document to be encoded and sent as an OTA message
$otapin – Optional PIN code for signing the OTA message
$otapintype – Type of PIN code (USERPIN or NETWPIN)
Assuming that you have created an XML document named f:/temp/bookmark.xml, the following function call could be used to submit this document for sending as an OTA message via NowSMS:
SendOTA(“127.0.0.1”, 8800, “username”, “password”, “+4499999999999”, “f:/temp/bookmark.xml”, “0000”, “USERPIN”);
PIN codes are always the most confusing part of sending an OTA message.
An OTA PIN can be associated with many of the XML settings types to provide a layer of authentication to the message. Many devices will allow you to send XML settings without a PIN, but some will require a PIN to be present before the settings will be accepted at all.
There are three different types of PINs, depending on the “OTA PIN Type” ($otapintype) setting.
The simplest “OTA PIN Type” is “USERPIN” (User PIN). This setting indicates that a short PIN code (often 4 digits) is supplied as the “OTA PIN”. When the user receives the OTA settings message, they will need to supply this PIN code in order to be able to open the message and apply the settings. If a “PINValue” is specified, but a “PINType” is not, then USERPIN will be assumed.
“NETWPIN” (Network PIN) indicates the PIN is a network PIN code. In the GSM environment, this is the IMSI number associated with the SIM card in the device. (Hint, if you want to experiment with determining the PIN card associated with a SIM, you can put the SIM into a GSM modem and the AT+CIMI command to return the IMSI. However, not all GSM modems support the AT+CIMI command.) When the device receives the settings, if the NETWPIN does not match the IMSI, the settings will be discarded.
An additional type of PIN, known as “USERNETWPIN” also exists, which indicates a combination of the USERPIN and NETWPIN types. To use this OTA PIN type, specify the OTA PIN as the IMSI number associated with the SIM card in the device, followed by a “:” character, followed by a USERPIN (e.g., 1234567889012345:1234). When the device receives the settings, the user will be prompted for a PIN. This user supplied PIN, and the SIM card IMSI, must match in order for the settings to be accepted.