Outreach API Documentation
Outreach API Documentation
1ST 4 Connect (PVT) Limited | 2 Floor | 89-A Danepur Road | GOR 1 | Lahore | Pakistan
1ST 4 Connect (PVT) Limited | 33-C Zamzama 6 | D.H.A Phase V | Karachi | Pakistan
Lahore: +(92) 042 111-008-339 | Karachi: +(92) 021 111-008-339 | f: +92(0) 42 3742 1219
e: [email protected]| www.1st4connect.com
Table of Contents
type (optional) Xml Type is XML and json. Not Case sensitive. Default is
xml. If set, the result will be returned according to the
type specified.
Example:
Each message returns a unique identifier in the form of Transaction ID.
URL:
http://outreach.pk/api/sendsms.php/sendsms/url?id=92300xxxxxxx&pass= xxxxxxxxxxxx
&mask= Outreach&to=92300xxxxxxx&lang=English&msg=Hello&type=xml
Success Response:
Error Response:
<?xml version="1.0" encoding="UTF-8" ?>
<corpsms>
<code>200</code>
<type>Error</type>
<response>Invalid API id/password for the customer.</response>
<transactionID>1</transactionID>
</corpsms>
2. CODE EXAMPLES
PHP
<?php
// Configuration variables
$type = "xml";
$id = "92300xxxxxxx";
$pass = "xxxxxxxxxxxx";
$lang = "English";
$mask = "Outreach";
$ch = curl_init('http://www.outreach.pk/api/sendsms.php/sendsms/url');
curl_setopt($ch, CURLOPT_HEADER, 0); // no headers in the output
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // output to variable
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port);
curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $loginpassw);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
?>
ASP
<%
responseType = "xml"
id = "92300xxxxxxx"
pass = "xxxxxxxxxxxx"
lang = "English"
nd
1ST 4 Connect (PVT) Limited | 2 Floor | 89-A Danepur Road | GOR 1 | Lahore | Pakistan
1ST 4 Connect (PVT) Limited | 33-C Zamzama 6 | D.H.A Phase V | Karachi | Pakistan
Lahore: +(92) 042 111-008-339 | Karachi: +(92) 021 111-008-339 | f: +92(0) 42 3742 1219
e: [email protected]| www.1st4connect.com
mask = "Outreach"
toNum = "92300xxxxxxx"
message = "Hello this is a test with a 5 note and an ampersand (&) symbol"
message = Server.urlencode(message) 'encode special characters (e.g. ?, & etc)
address = "http://www.outreach.pk/api/sendsms.php/sendsms/url"
url = address & "?id=" & id & "&pass=" & pass & "&msg=" & message & "&to=" & toNum & "&mask=" & mask &
"&lang=" & lang & "&type=" & responseType
JAVA
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class SMSSender {
// Construct data
String data = "id=" + URLEncoder.encode("92300xxxxxxx", "UTF-8");
data += "&pass=" + URLEncoder.encode("xxxxxxxxxxxx", "UTF-8");
data += "&msg=" + URLEncoder.encode(sMessage, "UTF-8");
data += "&lang=" + URLEncoder.encode("English", "UTF-8");
data += "&to=" + URLEncoder.encode(sToPhoneNo, "UTF-8");
data += "&mask=" + URLEncoder.encode("Outreach", "UTF-8");
data += "&type=" + URLEncoder.encode("xml", "UTF-8");
// Send data
URL url = new URL("http://www.outreach.pk/api/sendsms.php/sendsms/url");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String sResult="";
while ((line = rd.readLine()) != null) {
// Process line...
sResult=sResult+line+" ";
}
wr.close();
rd.close();
return sResult;
} catch (Exception e) {
System.out.println("Error SMS "+e);
return "Error "+e;
}
}
public static void main(String[] args) {
String result = sendSms("92300xxxxxxx","Hello this is a test with a 5 note and an ampersand (&)
symbol");
System.out.println(result);
}
}
C#
objRequest.Method = "POST";
nd
1ST 4 Connect (PVT) Limited | 2 Floor | 89-A Danepur Road | GOR 1 | Lahore | Pakistan
1ST 4 Connect (PVT) Limited | 33-C Zamzama 6 | D.H.A Phase V | Karachi | Pakistan
Lahore: +(92) 042 111-008-339 | Karachi: +(92) 021 111-008-339 | f: +92(0) 42 3742 1219
e: [email protected]| www.1st4connect.com
objRequest.ContentLength = Encoding.UTF8.GetByteCount(strPost);
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(strPost);
}
catch (Exception e)
{
return e.Message;
}
finally
{
myWriter.Close();
}
C# Using Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Web;
namespace S4CFirewall
{
class Program
{
static void Main(string[] args)
{
string url = "http://www.outreach.pk/api/sendsms.php/sendsms/url";
String result = "";
String message = HttpUtility.UrlEncode("Hello this is a test with a 5 note and an ampersand (&) symbol");
String strPost = "id=YOUR_ID&pass=YOUR_PASSWORD&msg=" + message + "&to=92300xxxxxxx" +
"&mask=Outreach&type=xml&lang=English";
StreamWriter myWriter = null;
nd
1ST 4 Connect (PVT) Limited | 2 Floor | 89-A Danepur Road | GOR 1 | Lahore | Pakistan
1ST 4 Connect (PVT) Limited | 33-C Zamzama 6 | D.H.A Phase V | Karachi | Pakistan
Lahore: +(92) 042 111-008-339 | Karachi: +(92) 021 111-008-339 | f: +92(0) 42 3742 1219
e: [email protected]| www.1st4connect.com
try
{
WebProxy myProxy = new WebProxy();
myProxy.Address = new Uri("YOUR_PROXY"); //Example : http://LHR-18P-PROX:8080
myProxy.Credentials = new NetworkCredential("YOUR_PROXY_USERNAME", "YOUR_PROXY_PASSWORD");
objRequest.Proxy = myProxy;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.ReadLine();
}
objRequest.Method = "POST";
objRequest.ContentLength = Encoding.UTF8.GetByteCount(strPost);
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(strPost);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally { myWriter.Close();
}
VB6
myURL = "http://www.outreach.pk/api/sendsms.php/sendsms/url"
postData = "id=92300xxxxxxx&pass=xxxxxxxxxxxx&msg=" + message +
"&to=92300xxxxxxx&mask=Outreach&type=xml&lang=English"
SendSMS_Text = winHttpReq.responseText
Example:
URL:
http://outreach.pk/api/sendsms.php/delivery/status?id=923084443779&pass=xxxxxxxx&transaction
=1
Success Response:
Error Response:
<?xml version="1.0" encoding="UTF-8" ?>
<corpsms>
<code>200</code>
<type>Error</type>
<response>Invalid API ID/Password</response>
</corpsms>
nd
1ST 4 Connect (PVT) Limited | 2 Floor | 89-A Danepur Road | GOR 1 | Lahore | Pakistan
1ST 4 Connect (PVT) Limited | 33-C Zamzama 6 | D.H.A Phase V | Karachi | Pakistan
Lahore: +(92) 042 111-008-339 | Karachi: +(92) 021 111-008-339 | f: +92(0) 42 3742 1219
e: [email protected]| www.1st4connect.com
Example:
URL:
http://outreach.pk/api/sendsms.php/balance/status?id=xxxxxxxx&pass=xxxxxxxx
Success Response:
<?xml version="1.0" encoding="UTF-8" ?>
<corpsms>
<code>100</code>
<type>Success</type>
<response>5913</response>
</corpsms>
Error Response:
<?xml version="1.0" encoding="UTF-8" ?>
<corpsms>
<code>200</code>
nd
1ST 4 Connect (PVT) Limited | 2 Floor | 89-A Danepur Road | GOR 1 | Lahore | Pakistan
1ST 4 Connect (PVT) Limited | 33-C Zamzama 6 | D.H.A Phase V | Karachi | Pakistan
Lahore: +(92) 042 111-008-339 | Karachi: +(92) 021 111-008-339 | f: +92(0) 42 3742 1219
e: [email protected]| www.1st4connect.com
<type>Error</type>
<response>Invalid API ID/Password</response>
</corpsms>
Appendix-A
Error Codes
Code Description
Appendix-B
Status
Code Description
100 Successful
101 UnSuccessful