Day: July 6, 2020

Perl

We offer code samples to make it easy for you to plug in SMS functionality into your applications.Download our SDK that contains sample projects in many languages or go straight to the language you need with our code samples. Code Sample #!/usr/bin/perl -w$file=”cgi-lib”;do $file || die “Fatal Error: Can’t load cgi library – $file\n”;&ReadParse;use CGI qw(:all);use LWP::UserAgent;$ua …

Perl Read More »

VB.NET

We offer code samples to make it easy for you to plug in SMS functionality into your applications. Download our SDK that contains sample projects in many languages or go straight to the language you need with our code samples. Code Sample Public Class MessageDim postURL As String = “http://gateway.2sms.us/xml/xml.jsp” Dim username As StringDim password As StringSub …

VB.NET Read More »

VBA

We offer code samples to make it easy for you to plug in SMS functionality into your applications. Code Sample Sub test()     Dim xmlstring As String     Username = “user@mailaddress.com”    Password = “yourpass”    Message = “Your Message Here”    Destination = “447777777777”    xmlstring = “<?xml version=” & Chr(34) & “1.0” & Chr(34) & “?> ” …

VBA Read More »

Python

We offer code samples to make it easy for you to plug in SMS functionality into your applications. Code Sample #!/usr/bin/env python import httplib def sendSMS(username, password,destination, message):        body = “<?xml version=\”1.0\” encoding=\”UTF-8\” ?>”+\               “<Request xmlns:xsi=\”http://www.w3.org/2001/XMLSchema-instance\”” +\   :noNamespaceSchemaLocation=\”http://schema.2sms.us/1.0/0410_RequestSendMessage.xsd\”   ” +\        “Version=\”1.0\”><Identification>” +\        “<UserID>” + username +”</UserID>” +\        “<Password>”+password+”</Password>” +\        “</Identification>” +\        “<Service>” +\        “<ServiceName>SendMessage</ServiceName>” +\        …

Python Read More »

PHP

We offer code samples to make it easy for you to plug in SMS functionality into your applications. Code Sample $user = ‘user@company.com’;$pass = ‘myPassword’; $text = substr($HTTP_POST_VARS[‘text’], 0, 160); $mobnum = $HTTP_POST_VARS[‘mobnum’]; $result = ”; $myOutMsg = ‘<?xml version=”1.0″ encoding=”UTF-8″ ?>’;$myOutMsg .= ‘<Request xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” ‘;$myOutMsg .= ‘xsi:noNamespaceSchemaLocation=”http://schema.2sms.us/1.0/0410_RequestSendMessage.xsd” ‘;$myOutMsg .= ‘Version=”1.0″>’;$myOutMsg .= ‘<Identification>’;$myOutMsg .= ‘<UserID>’ …

PHP Read More »

Java

We offer code samples to make it easy for you to plug in SMS functionality into your applications.Download our SDK that contains sample projects in many languages or go straight to the language you need with our code samples. Code Sample package com.twoSms; import java.io.OutputStreamWriter;import java.net.URL;import java.net.URLConnection; import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class SmsJava{    …

Java Read More »

C#

private string formXml(string username, string password, string destination, string message){ // create xml stringstring xmlString = “<?xml version=\”1.0\” encoding=\”UTF-8\” ?> ” +“<Request xmlns:xsi=\”http://www.w3.org/2001/XMLSchema-instance\” xsi:noNamespaceSchemaLocation=\”http://schema.2sms.us/1.0/0410_RequestSendMessage.xsd\” Version=\”1.0\”>” +“<Identification>” +   “<UserID>”+username+”</UserID>” +   “<Password>”+password+”</Password>” +“</Identification>” +“<Service>” +   “<ServiceName>SendMessage</ServiceName>” +   “<ServiceDetail>” +      “<SingleMessage>” +         “<Destination>”+destination+”</Destination>” +         “<Text>”+message+”</Text>” +      “</SingleMessage>” +    “</ServiceDetail>” +“</Service>” +“</Request>”; return xmlString;} private string sendXml(string xmlDoc){  string …

C# Read More »

Standard Reporting

Standard Reporting is requesting a succession of XML reports for yourself using the ‘LoggedReport’ method of our XML schema (schema code 0310). Of course, many users will simply choose to request XML reports from 2sms at less frequent intervals and lower their reporting costs this way. This is a perfectly sensible approach to the problem, …

Standard Reporting Read More »

Status Updates

Status Updates is a service that 2sms provides that allows you to monitor the progress of your messages through the SMS network. Prerequisites You have registered to the 2sms system and have a valid account with message credits. Receiver page URL provided to 2sms for HTTP POST. Click here for an example of HTTP POST. …

Status Updates Read More »

Scroll to Top