<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Text Marketer - Email SMS, Bulk SMS Gateway, SMS Marketing Blog &#187; All SMS Gateway Documentation</title>
	<atom:link href="http://www.textmarketer.co.uk/blog/category/sms-gateway/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.textmarketer.co.uk/blog</link>
	<description>SMS Gateway</description>
	<lastBuildDate>Tue, 07 Feb 2012 09:50:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Buying Bulk SMS Services &#8211; 2 things to look out for</title>
		<link>http://www.textmarketer.co.uk/blog/2011/05/sms-gateway/buying-bulk-sms-services-2-things-to-look-out-for/</link>
		<comments>http://www.textmarketer.co.uk/blog/2011/05/sms-gateway/buying-bulk-sms-services-2-things-to-look-out-for/#comments</comments>
		<pubDate>Mon, 23 May 2011 08:58:19 +0000</pubDate>
		<dc:creator>Henry</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[SMS Providers]]></category>
		<category><![CDATA[Bulk SMS]]></category>
		<category><![CDATA[Bulk sms service]]></category>

		<guid isPermaLink="false">http://www.textmarketer.co.uk/blog/?p=2744</guid>
		<description><![CDATA[Buying bulk sms services is pretty straightforward really. A quick Google search for something generic like &#8216;bulk sms&#8217; reveals a huge range of providers. Having had a quick look through a couple of pages of search results, you&#8217;ll probably arrive at a decent shortlist of half a dozen possible suppliers. Having established your short list &#8230; <a href="http://www.textmarketer.co.uk/blog/2011/05/sms-gateway/buying-bulk-sms-services-2-things-to-look-out-for/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Buying <a href="http://www.textmarketer.co.uk/bulksms/sms-bulk.htm">bulk sms</a> services is pretty straightforward really. A quick Google search for something generic like &#8216;bulk sms&#8217; reveals a huge range of providers. Having had a quick look through a couple of pages of search results, you&#8217;ll probably arrive at a decent shortlist of half a dozen possible suppliers.</p>
<p>Having established your short list of  bulk sms companies, you&#8217;ll then probably look at details such as the system itself, pricing, support and so on. There are 2 things that you should watch out for though, that might not be immediately apparant when you&#8217;re making your decision about which bulk <a href="http://www.textmarketer.co.uk">sms service</a> to use.</p>
<h3><strong>Expiring Credits</strong></h3>
<p>About 30% of bulk sms suppliers operate a curious policy of expiring sms credits. If you don&#8221;t use your bulk sms credits in a given period (usually 12 months), then your unused credits just disappear. We&#8217;ve always felt this a particularly harsh approach. After all you&#8217;ve purchased your bulk sms credits, it would seem reasonable to have as long as you want to use them. Take a look at our <a href="http://www.textmarketer.co.uk/bulk-sms-prices.htm#compare">bulk sms price comparison table</a>, which also includes information about whether each company has an expiring credits policy.</p>
<h3>Unclear Pricing</h3>
<p>You&#8217;d expect that when you&#8217;re looking at cost per bulk sms credit, that would mean the cost to send one text. Correct? Not necessarily. There are 2 companies that operate a credits systems where it costs more than one bulk sms text credit to send a message to a UK mobile. So a headline price of say 4.2 pence + VAT per credit may actually cost 6.75 pence + VAT to deliver the text. (1.5 credits needed to send a message to a UK mobile.)</p>
<p>The argument here is that when you have international bulk sms services, there are different prices for different counties so you need a system that can handle this. We&#8217;re not sure that this is the best way though and we know this causes confusion for buyers, It&#8217;s much clearer to have a simple 1 text credit is 1 text sent system.</p>
<p>If you haven&#8217;t already done so, you can set a free bulk sms account with Text Markerter <a href="http://www.textmarketer.co.uk/signUpGoogle/">here</a>. You can assume that your credits  will never expire and the pricing is on a simple, 1 sms credit is 1 sms sent basis.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=2744&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2011/05/sms-gateway/buying-bulk-sms-services-2-things-to-look-out-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST SMS Gateway API &#8211; group resource</title>
		<link>http://www.textmarketer.co.uk/blog/2011/04/sms-gateway/rest-sms-gateway-api-group-resource/</link>
		<comments>http://www.textmarketer.co.uk/blog/2011/04/sms-gateway/rest-sms-gateway-api-group-resource/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 14:42:15 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.textmarketer.co.uk/blog/?p=2429</guid>
		<description><![CDATA[group This resource allows you to view and modify a send group. This blog post has been superseded with our website documentation This document is referred to by the REST SMS Gateway API &#8211; Specification Document. Resource URI: http://www.textmarketer.biz/services/rest/group Actions relating to send groups. POST method - Used to add number(s) to a group. &#160; &#8230; <a href="http://www.textmarketer.co.uk/blog/2011/04/sms-gateway/rest-sms-gateway-api-group-resource/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div>
<h2><em><strong>group</strong></em></h2>
<p>This resource allows you to view and modify a send group.<br />
<a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a><br />
This document is referred to by the <a title="API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/">REST SMS Gateway API &#8211; Specification Document</a>.</p>
<p><em><strong>Resource URI:</strong></em></p>
<pre>http://www.textmarketer.biz/services/rest/group</pre>
<p>Actions relating to send groups.</p>
<ul>
<li><a title="post method" href="#post">POST method</a> - Used to add number(s) to a group.</li>
</ul>
<p>&nbsp;</p>
<p><a id="post"></a><em><strong>POST method</strong></em></p>
<p>Attempts to add a number or numbers to a group.</p>
<p>Example usage:</p>
<pre>http://www.textmarketer.biz/services/rest/group</pre>
<p>Post arguments:</p>
<table border="0">
<tbody>
<tr>
<td width="100px"><strong>parameter</strong></td>
<td><strong>usage</strong></td>
</tr>
<tr>
<td>id</td>
<td>the ID of the group to add to (optional &#8211; if you use &#8216;name&#8217; instead)</td>
</tr>
<tr>
<td>name</td>
<td>the name of the group to send to &#8211; case-sensitive (optional &#8211; if you use &#8216;id&#8217; instead)</td>
</tr>
<tr>
<td>numbers</td>
<td>a comma-separated list of numbers to add to the group</td>
</tr>
</tbody>
</table>
<p>NOTE: If you specify a group by it&#8217;s name, and the name is not unique, the first matched group will be used.</p>
<p>Example POST response:</p>
<pre id="line1">&lt;response processed_date="2011-04-07T14:57:00+01:00"&gt;
&lt;added quantity="1"&gt;
&lt;number&gt;447777000001&lt;/number&gt;
&lt;/added&gt;
&lt;stopped quantity="0"&gt;&lt;/stopped&gt;
&lt;duplicates quantity="1"&gt;
&lt;number&gt;447777000002&lt;/number&gt;
&lt;/duplicates&gt;
&lt;/response&gt;</pre>
<ul>
<li>quantity &#8211; the number of added/stopped/duplicate numbers</li>
<li>added &#8211; a list of numbers successfully added to the group</li>
<li>stopped &#8211; a list of numbers that were not added to the group since they are members of a STOP group</li>
<li>duplicates &#8211; a list of numbers that were not added to the group since they are already members of the group</li>
</ul>
<p><a title="REST SMS API DTD specification and  documentation" href="http://www.textmarketer.biz/services/rest/DTD/" target="_self">Read the advanced specification of this response</a>.</p>
<p>Specific error codes:</p>
<table border="0">
<tbody>
<tr>
<td width="100px"><strong>Code</strong></td>
<td><strong>Meaning</strong></td>
</tr>
<tr>
<td>0</td>
<td>the group ID or name was not specified or was invalid</td>
</tr>
<tr>
<td>1</td>
<td>group ID or name did not correspond to any known group</td>
</tr>
<tr>
<td>2</td>
<td>no numbers were supplied for adding to the group</td>
</tr>
<tr>
<td>3</td>
<td>a number was not of a valid format</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Example XML error response:</p>
<pre id="line1">&lt;response processed_date="2011-04-07T15:04:19+01:00"&gt;
&lt;errors&gt;
	&lt;error code="1"&gt;Group not found&lt;/error&gt;
&lt;/errors&gt;
&lt;/response&gt;</pre>
<p>Example PHP code:</p>
<pre>
<div>&lt;?php</div>
<div>/**</div>
<div>* POST request on the 'group' resource (add numbers to group)</div>
<div>*/</div>
<div>$url = 'http://www.textmarketer.biz/services/rest/group';</div>
<div>// for testing:</div>
<div>$url = 'http://sandbox.textmarketer.biz/services/rest/group';</div>
<div>$username = 'myAPIusername'; // CHANGE THIS!!!</div>
<div>$password = 'myAPIpassword'; // CHANGE THIS!!!</div>
<div>$groupName = 'MyGroupName'; // CHANGE THIS!!</div>
<div>$numbersToAdd = '447777000001,447777000002'; // CHANGE THIS!!</div>
<div>$data = array('name'=&gt;$groupName, 'numbers'=&gt;'$numbersToAdd',</div>
<div>'username'=&gt;$username, 'password'=&gt;$password);</div>
<div>$data = http_build_query($data, '', '&amp;');</div>
<div>// we're using the curl library to make the request</div>
<div>$curlHandle = curl_init();</div>
<div>curl_setopt($curlHandle, CURLOPT_URL, $url);</div>
<div>curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);</div>
<div>curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);</div>
<div>curl_setopt($curlHandle, CURLOPT_POST, 1);</div>
<div>$responseBody = curl_exec($curlHandle);</div>
<div>$responseInfo  = curl_getinfo($curlHandle);</div>
<div>curl_close($curlHandle);</div>
<div></div>
<div>// deal with the response</div>
<div>if ($responseInfo['http_code']==200)</div>
<div>{</div>
<div>$xml_obj = simplexml_load_string($responseBody);</div>
<div>// do something with the result</div>
<div>$xml_added = $xml_obj-&gt;added;</div>
<div>$atts = $xml_added-&gt;attributes();</div>
<div>$added = (integer) $atts-&gt;quantity;</div>
<div>echo "$added added";</div>
<div>} else {</div>
<div>// handle the error here</div>
<div>var_dump($responseInfo);</div>
<div>var_dump($responseBody);</div>
<div>}</div>
<div>?&gt;</div>
</pre>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;"><span style="font-size: 12px; line-height: 18px; white-space: pre;"><br />
</span></span></p>
</div>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=2429&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2011/04/sms-gateway/rest-sms-gateway-api-group-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Goldmine with our SMS Gateway</title>
		<link>http://www.textmarketer.co.uk/blog/2011/03/sms-gateway/integrating-goldmine-with-our-sms-gateway/</link>
		<comments>http://www.textmarketer.co.uk/blog/2011/03/sms-gateway/integrating-goldmine-with-our-sms-gateway/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 16:09:29 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[goldmine]]></category>
		<category><![CDATA[messages]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://www.textmarketer.co.uk/blog/?p=2276</guid>
		<description><![CDATA[How to integrate Goldmine software with our SMS Gateway The 2 easiest methods of integrating Goldmine with our SMS Gateway are using; 1) The email to SMS gateway &#8211; http://www.textmarketer.co.uk/email-to-sms-gateway/email-sms.htm Or 2) The HTTP gateway &#8211; http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/ &#160; &#160;]]></description>
			<content:encoded><![CDATA[<h2>How to integrate Goldmine software with our SMS Gateway</h2>
<p>The 2 easiest methods of integrating Goldmine with our SMS Gateway are using;</p>
<p>1) The email to SMS gateway &#8211; <a href="http://www.textmarketer.co.uk/email-to-sms-gateway/email-sms.htm">http://www.textmarketer.co.uk/email-to-sms-gateway/email-sms.htm</a><br />
Or<br />
2) The HTTP gateway &#8211; <a href="http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=2276&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2011/03/sms-gateway/integrating-goldmine-with-our-sms-gateway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMS Gateway in PHP</title>
		<link>http://www.textmarketer.co.uk/blog/2011/02/dev/sms-gateway-in-php/</link>
		<comments>http://www.textmarketer.co.uk/blog/2011/02/dev/sms-gateway-in-php/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 16:36:29 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Bulk SMS]]></category>
		<category><![CDATA[Development Blog]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sms gateway in php]]></category>

		<guid isPermaLink="false">http://www.textmarketer.co.uk/blog/?p=2206</guid>
		<description><![CDATA[Build an SMS Gateway in PHP It&#8217;s a very straightforward task to build a small script in PHP to utilise our SMS Gateway to send out text messages. The benefit of integrating your SMS Gateway with Text Marketer is that we have the lowest cost per message of any company &#8230; <a href="http://www.textmarketer.co.uk/blog/2011/02/dev/sms-gateway-in-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Build an <a href="http://www.textmarketer.co.uk/sms-gateway.htm">SMS Gateway in PHP</a></h2>
<p>It&#8217;s a very straightforward task to build a small script in PHP to utilise our SMS Gateway to send out text messages.</p>
<p>The benefit of integrating your SMS Gateway with Text Marketer is that we have the <a href="http://www.textmarketer.co.uk/bulk-sms-prices.htm">lowest cost per message</a> of any company in the UK.</p>
<p>You can find a sample PHP script for our <a href="http://www.textmarketer.co.uk/sms-gateway.htm">SMS Gateway</a> here and with a few basic modifications of the user details you should be able to have your application integrated within minutes.</p>
<p>We do also provide code snippets for other languages;</p>
<ul>
<li><span style="font-size: x-small;"><a href="http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">PHP code example</a></span></li>
<li><span style="font-size: x-small;"><a href="http://www.textmarketer.co.uk/blog/2011/01/technical/sms-visual-c-net-console-example/">Visual C#.Net Console</a></span></li>
<li><span style="font-size: x-small;"><a href="http://www.textmarketer.co.uk/blog/2010/02/technical/1045/">Delphi/Pascal Interface</a></span></li>
<li><span style="font-size: x-small;"><a href="http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/net-examples/">.NET examples</a></span></li>
<li><span style="font-size: x-small;"><a href="http://www.textmarketer.co.uk/blog/2009/06/documentation/bulk-sms-api-asp-help/">ASP examples</a></span></li>
<li><span style="font-size: x-small;"><a href="http://www.textmarketer.co.uk/blog/2010/03/business-sms/rest-sms-api-specification-document/">REST examples</a></span></li>
</ul>
<p>If you have any queries or questions, our friendly and highly experienced technical team will be happy to help you out.</p>
<p>After 11 years of building SMS Gateways in PHP and other programming lanuguages, we&#8217;re confident we can help you overcome any task.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=2206&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2011/02/dev/sms-gateway-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email-to-SMS Gateway service from Text Marketer</title>
		<link>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/email-to-sms-gateway-service-from-text-marketer/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/email-to-sms-gateway-service-from-text-marketer/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 13:37:21 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All Bulk SMS Account Documentation]]></category>
		<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Email to SMS]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[hotmail]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1636</guid>
		<description><![CDATA[Please note that this blog page has been superseded with http://www.textmarketer.co.uk/developers/sms-email-gateway.htm  Our email-to-SMS service provides a simple way for you to send text messages via email. This is in addition to our simple HTTP SMS Gateway API, explained here, and we also provide a more complex RESTful SMS API to send SMS messages and &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/email-to-sms-gateway-service-from-text-marketer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Please note that this blog page has been superseded with<a href="http://www.textmarketer.co.uk/developers/sms-email-gateway.htm"> http://www.textmarketer.co.uk/developers/sms-email-gateway.htm </a></p>
<p>Our email-to-SMS service provides a simple way for you to send text messages via email.</p>
<p>This is in addition to our simple HTTP <a title="SMS Gateway API" href="/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">SMS Gateway API</a>, explained <a title="SMS Gateway API" href="/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">here</a>, and we also provide a more complex <a title="RESTful SMS API" href="/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/">RESTful SMS API</a> to send SMS messages and give you access to information about your <a title="Get an SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/" target="_self">SMS marketing account</a> (dont have one? You need to have an <a title="Free SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/">account</a>).</p>
<p><strong>There are 3 main ways to use the email to sms gateway;</strong></p>
<p>Option 1 &#8211; To send single emails/messages using domain authentication<br />
Option 2 &#8211; To send single emails/messages using username/password authentication<br />
Option 3 &#8211; To send messages to multiple recipients with a single email (and advanced features)</p>
<p>&nbsp;</p>
<h2><strong>Option 1 &#8211; Send single emails/messages using domain authentication</strong></h2>
<p>This option is used when you cannot or do not want to transmit your username and password in the subject field of the email. You set your sending domain in your account, e.g. mycompanyname.com which is what we use for validation when the email comes in. Only emails sent from the domain you set will be accepted (no generic email accounts like hotmail or gmail are acceptable).</p>
<p><strong>Step 1</strong> &#8211; enable domain authentication in your Text Marketer account. <strong>Go to Settings | Account Settings</strong> as shown below.</p>
<p><a href="http://www.textmarketer.co.uk/wordpress/wp-content/uploads/2010/06/Fullscreen-capture-18052011-100448.jpg"><img class="alignnone size-full wp-image-2718" title="Fullscreen capture 18052011 100448" src="http://www.textmarketer.co.uk/wordpress/wp-content/uploads/2010/06/Fullscreen-capture-18052011-100448.jpg" alt="" width="480" height="292" /></a></p>
<p>&nbsp;</p>
<p>Under &#8220;Email Gateway Settings&#8221; enter your domain name (<em>e.g. if your email address was richard@greens.com then your domain name is greens.com</em>) in the field and press <strong>submit </strong>(do not include the @ sign). The system will return an &#8216;updated&#8217; message.</p>
<p>Then, click <strong>change </strong>next to your domain name and make sure it turns from disabled to <span style="color: #ff0000;"><strong>Active </strong></span>(in red).</p>
<p><strong>Step 2</strong> &#8211; now you are ready to send a test message. Format the email address as [mobilenumber]@textmarketer.biz (for example, <a href="mailto:447777111999@textmarketer.biz">447777111999@textmarketer.biz</a>) and send it our gateway. Make sure you add ## to the end of the text in the body you want to send (this tells our system that this is the end of the text to send out and avoids sending things like signatures etc). You can change the message termination string by logging into your account and navigating to &#8220;settings&#8221; =&gt; &#8220;Account Settings&#8221;.<br />
You don&#8217;t have to put anything in the subject line as it&#8217;s not used.</p>
<p>Here&#8217;s an example message (note the ## added at the end of the text to be sent):</p>
<p><a href="http://www.textmarketer.co.uk/wordpress/wp-content/uploads/2010/06/Fullscreen-capture-18052011-095127.jpg"><img class="alignnone size-full wp-image-2715" title="Fullscreen capture 18052011 095127" src="http://www.textmarketer.co.uk/wordpress/wp-content/uploads/2010/06/Fullscreen-capture-18052011-095127.jpg" alt="" width="480" height="278" /></a></p>
<p>&nbsp;</p>
<h2><strong>Option 2 &#8211; To send single emails/messages using username/password authentication</strong></h2>
<p>This option is exactly the same as option 1 apart from you do not need to turn on domain authentication in your account and instead you use your API username and password in the subject field (formed like <em>username%password</em>) of the email for authentication. You can find your API username and password in your  account on the <strong>Settings | API Settings</strong> page.</p>
<p>So your email would look like this:</p>
<p><a href="http://www.textmarketer.co.uk/wordpress/wp-content/uploads/2010/06/Fullscreen-capture-18052011-095743.jpg"><img class="alignnone size-full wp-image-2716" title="Fullscreen capture 18052011 095743" src="http://www.textmarketer.co.uk/wordpress/wp-content/uploads/2010/06/Fullscreen-capture-18052011-095743.jpg" alt="" width="480" height="277" /></a></p>
<p>&nbsp;</p>
<h2><strong>Option 3 &#8211; To send messages to multiple recipients with a single email (and advanced features)</strong></h2>
<p><img class="alignnone size-full wp-image-1662" style="border: black 1px solid;" title="fullscreen-capture-01072010-143626bmp" src="http://www.textmarketer.co.uk/blog/wp-content/uploads/2010/06/fullscreen-capture-01072010-143626bmp.jpg" alt="fullscreen-capture-01072010-143626bmp" width="480" height="217" /></p>
<p>1. Create an email to the address shown above<br />
<strong>IMPORTANT</strong>: this must be the gateway[at]textmarketer.co.uk address, not a [number]@ style address or it will fail.<br />
2. Put your API username and password in the subject field with a % symbol in between (no spaces). You can find your API username and password in your  account on the Settings &gt; API Settings page but it is usually the same unless you&#8217;ve updated your login details.<br />
3. Type the text message you want to send and at the end put two hash symbols &#8220;##&#8221;<br />
4. Put 1 or many numbers in a single column underneath (it&#8217;s always best in international format but UK numbers starting 07&#8230;&#8230; are OK too).<br />
5. Send the email!</p>
<p><strong><br />
Expanded Instructions / Additional Features</strong></p>
<p>The Email-to-SMS (or email-to-text-message) service allows you to send SMS text messages via email. You must have an <a title="Get an SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/" target="_self">SMS marketing account</a> (you can create a <a title="Free SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/">free account here</a>) to send text messages via this service.</p>
<p>The actual email address of the email-to-SMS gateway is shown in the screenshot above (gateway@ and the domain is textmarketer.co.uk).</p>
<p>To send a text message to one or more mobile numbers, you will specify the message to send, and the numbers to send to, in an email. You then send the email to our email-to-sms gateway email address (using a specific format/structure).</p>
<p>Let&#8217;s say you want to send a text message containing &#8216;Call us for a quote&#8217; to the UK mobile number 07777123456. To do this your email contents would look like this:</p>
<pre>Call us for a quote##
07777123456</pre>
<p>The &#8216;##&#8217; characters simply tell us that this is the end of the message to be sent. And it&#8217;s followed by the mobile number. That&#8217;s it!</p>
<p><strong>IDENTIFICATION</strong></p>
<p>Your email will contain your account&#8217;s API username and password in the email <em>subject</em>. This allows us to verify your identity and deduct credits for the text messages sent from your account.</p>
<p>Your email subject should contain your API username, followed by &#8216;%&#8217;, followed by your API password (You can find your API username and password in your  account on the &#8216;Settings&#8217; &gt; &#8216;API Settings&#8217; page.), e.g.</p>
<pre>myAPIusername%myAPIpassword</pre>
<p><strong>Example</strong></p>
<p>So the complete email (subject and body) would look like this:</p>
<p>Email Subject:</p>
<pre>myAPIusername%myAPIpassword</pre>
<p>Email Body/Contents:</p>
<pre>Call us for a quote##
07777123456</pre>
<p><strong>MULTIPLE RECIPIENTS</strong></p>
<p>You want to send a text message via email to more than one mobile number? No problem! Simply list the numbers on separate lines, like this:</p>
<pre>Call us for a quote##
07777123456
07777123457</pre>
<p>Or put them on the same line, with commas in between to separate the numbers, like this:</p>
<pre>Call us for a quote##
07777123456,07777123457</pre>
<p><strong>MESSAGE WITH MULTIPLE LINES</strong></p>
<p>A message sent using the email-to-SMS gateway can contain more than more line. Simply ensure the message still ends with &#8216;##&#8217;, e.g.:</p>
<pre>Special offer this week on:
- black tights
- green shoes##
07777123456</pre>
<p><strong>FROM/SENDER ID</strong></p>
<p>The sender ID is the number/name that your text message will appear as being sent from. When using the email-to-text API this defaults to the sender ID that is set in your account settings (see the &#8216;Send SMS&#8217; &gt; &#8216;Default Sender ID&#8217; page). For example, you might want to set the sender ID as the name of your business, or perhaps to your own mobile number.</p>
<p>The sender ID can be any 16-digit number, or any text of up to 11 alpha-numeric characters.</p>
<p><strong>Example</strong></p>
<p>Let&#8217;s say you want to send the message &#8216;Special 2-for-1 offer this week&#8217; to the UK mobile number 07777123456, with a sender ID of &#8216;Fast Pizzas&#8217;. Your email body (contents) would look like this:</p>
<pre>Special 2-for-1 offer this week##
Fast Pizzas#
07777123456</pre>
<p>The sender ID is &#8216;terminated&#8217;, i.e. ends with, a single &#8216;#&#8217; character. It can appear before or after the message, so this works too:</p>
<pre>Fast Pizzas#
Special 2-for-1 offer this week##
07777123456</pre>
<p><strong>ERROR REPORTING</strong></p>
<p>If your email-to-SMS request is successful, with no errors or problems, you will not get any response (unless you&#8217;re using the Sandbox service). However, if there are any problems with the format of your email, or problems sending to any of the numbers you specify in the email, you will get a verbose email response with details of the problem(s) encountered.</p>
<p>Note that you will not get any response if your API username or password (included in the email subject) were incorrect, or did not contain the &#8216;%&#8217; character to separate them.</p>
<p><strong>TESTING/SANDBOX</strong></p>
<p>If you want to test the service without actually sending any text messages, there is a different email address to use for this purpose:</p>
<p>gateway-sandbox@ followed by the same domain: textmarketer.co.uk</p>
<p>It works in the same way as the normal service, except that no text messages will be sent and therefore no credit will be deducted from your account. Also, unlike the normal service, you will get a confirmation email telling you what message would have been sent, and to what numbers, if you had used the normal live service.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1636&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/email-to-sms-gateway-service-from-text-marketer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST SMS Gateway API &#8211; keywords resource</title>
		<link>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-keywords-resource/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-keywords-resource/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:48:01 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1545</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation keywords This document is referred to by the REST SMS Gateway API &#8211; Specification Document. Resource URI: http://www.textmarketer.biz/services/rest/keywords/mykeyword Actions on the ShortCode keywords (see Short Code SMS Service). GET method &#8211; get the availability of a given keyword GET method Test whether the specified &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-keywords-resource/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<h2><em><strong>keywords</strong></em></h2>
<p>This document is referred to by the <a title="API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/">REST SMS Gateway API &#8211; Specification Document</a>.</p>
<p><em><strong><span style="font-style: normal;"><span style="font-weight: normal;">Resource URI:</span></span></strong></em></p>
<pre>http://www.textmarketer.biz/services/rest/keywords/mykeyword</pre>
<p>Actions on the ShortCode keywords (see <a href="http://www.textmarketer.co.uk/shortcode_sms.htm" target="_blank">Short Code SMS Service</a>).</p>
<ul>
<li><a title="get method" href="#get">GET method</a> &#8211; get the availability of a given keyword</li>
</ul>
<p><a id="get"></a><em><strong>GET method</strong></em></p>
<p>Test whether the specified keyword is available on our ShortCode number.</p>
<p><a title="resource ID" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#resource_identifier">RESOURCE_ID</a>: the keyword of which to test the availability, e.g. &#8216;mykeyword&#8217; in the example above</p>
<p><strong>Example usage</strong></p>
<pre>http://www.textmarketer.biz/services/rest/keywords/buyit</pre>
<p>will test whether &#8216;buyit&#8217; is an available keyword.</p>
<p><strong>Example GET response</strong></p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-05-06T13:43:18+02:00"</span>&gt;
&lt;<span class="start-tag">available</span>&gt;true&lt;/<span class="end-tag">available</span>&gt;
&lt;<span class="start-tag">recycle</span>&gt;false&lt;/<span class="end-tag">recycle</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p>The &lt;available&gt; tag shows whether the keyword is available (true/false) and the &lt;recycle&gt; tag shows whether the keyword<em> </em>is available through &#8216;recycling&#8217; a disused keyword, i.e. one that was in use previously.</p>
<p><a title="REST SMS API DTD specification and documentation" href="http://www.textmarketer.biz/services/rest/DTD/" target="_self">Read the advanced specification of this response</a>.</p>
<p><strong>Specific error codes</strong></p>
<p>N/A</p>
<p><strong>Example PHP code</strong></p>
<pre>&lt;?php
/**
 * GET request on the 'keywords' resource
 */
$url = 'http://www.textmarketer.biz/services/rest/keywords/mykeywordtest'; // CHANGE THIS!!!
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&amp;password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	$available =  $xml_obj-&gt;available == 'true';
	$recycled =  $xml_obj-&gt;recycle == 'true';
	// do something with the result
	if ($available)
		echo "Available ";
	else
		echo "Unavailable ";

	if ($recycled)
		echo "(recycled)";

} else {
	// handle the error
	var_dump($responseBody);
}
?&gt;</pre>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1545&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-keywords-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST SMS Gateway API &#8211; sms resource</title>
		<link>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-sms-resource/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-sms-resource/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:44:59 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1541</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation sms This resource deals with sending SMS to customer. This document is referred to by the REST SMS Gateway API &#8211; Specification Document. Resource URI: http://www.textmarketer.biz/services/rest/sms Actions relating to sending SMS messages. POST method - Used to send an SMS message. POST POST method Attempts &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-sms-resource/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<h2><em><strong>sms</strong></em></h2>
<p>This resource deals with sending SMS to customer.</p>
<p>This document is referred to by the <a title="API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/">REST SMS Gateway API &#8211; Specification Document</a>.</p>
<p><em><strong><span style="font-style: normal;"><span style="font-weight: normal;">Resource URI:</span></span></strong></em></p>
<pre>http://www.textmarketer.biz/services/rest/sms</pre>
<p>Actions relating to sending SMS messages.</p>
<ul>
<li><a title="post method" href="#post">POST method</a> - Used to send an SMS message.</li>
</ul>
<p style="color:white">POST</p>
<p><a id="post"></a><em><strong>POST method</strong></em></p>
<p>Attempts to send the specified SMS message.</p>
<p>Example usage:</p>
<pre>http://www.textmarketer.biz/services/rest/sms</pre>
<p>Post arguments:</p>
<table border="0">
<tbody>
<tr>
<td width="100px"><strong>parameter</strong></td>
<td><strong>usage</strong></td>
</tr>
<tr>
<td>message</td>
<td>the content of the message to be sent, up to 612 characters (see <a title="SMS Message concatination" href="#concatination" target="_self">Concatination below</a>) in the GSM alphabet. The GSM alphabet is a subset of ISO-8859-1. The SMS GSM characters we can support is <a title="GSM Character Set" href="http://www.textmarketer.co.uk/blog/2009/07/bulk-sms/supported-and-unsupported-characters-in-text-messages-gsm-character-set/" target="_blank">documented here</a></td>
</tr>
<tr>
<td>mobile_number</td>
<td>the mobile number of the recipient, in international format, e.g. 447777777777</td>
</tr>
<tr>
<td>originator</td>
<td>a string or international mobile number of the sender to be displayed to the recipient</td>
</tr>
<tr>
<td>username*</td>
<td>(optional) required if not using HTTP Digest authentication</td>
</tr>
<tr>
<td>password*</td>
<td>(optional) required if not using HTTP Digest authentication</td>
</tr>
</tbody>
</table>
<p>* Can be found by logging in to your account, Settings-&gt;API Settings</p>
<p style="color:white">CONCATENATION</p>
<p><a id="concatination"></a><strong><em>CONCATENATION</em></strong></p>
<p>If you exceed 160 characters you automatically invoke concatenation sending, this has the following consequences: Each message consists of a 153 character chunk, i.e. no longer 160 chars; the extra characters are used to glue the messages together. Therefore a message that is 307 characters long will require 3 messages to send (153 + 153 + 1).</p>
<p>Example POST response:</p>
<pre>&lt;response processed_date="2010-03-23T10:31:39+00:00"&gt;
	&lt;message_id&gt;4172870907&lt;/message_id&gt;
	&lt;credits_used&gt;1&lt;/credits_used&gt;
&lt;/response&gt;</pre>
<ul>
<li>message_id &#8211; the unique message ID attributed to the sent SMS</li>
<li>credits_used &#8211; the number of credits used to send the SMS</li>
</ul>
<p><a title="REST SMS API DTD specification and  documentation" href="http://www.textmarketer.biz/services/rest/DTD/" target="_self">Read the advanced specification of this response</a>.</p>
<p>Specific error codes:</p>
<table border="0">
<tbody>
<tr>
<td width="100px"><strong>Code</strong></td>
<td><strong>Meaning</strong></td>
</tr>
<tr>
<td>0</td>
<td>message refused by the operator</td>
</tr>
<tr>
<td>1</td>
<td>bad username or password</td>
</tr>
<tr>
<td>2</td>
<td>no more credits</td>
</tr>
<tr>
<td>3</td>
<td>invalid originator or too long</td>
</tr>
<tr>
<td>4</td>
<td>invalid or missing originator</td>
</tr>
<tr>
<td>5</td>
<td>invalid message or too long</td>
</tr>
<tr>
<td>6</td>
<td>you do not have enough credits for this message</td>
</tr>
<tr>
<td>7</td>
<td>invalid message or missing</td>
</tr>
<tr>
<td>8</td>
<td>message contains unsupported characters (listed in error message)</td>
</tr>
<tr>
<td>9</td>
<td>invalid number or too short</td>
</tr>
<tr>
<td>10</td>
<td>invalid number or not an integer</td>
</tr>
</tbody>
</table>
<p style="color:white">CONCATENATION</p>
<p>Example XML error response:</p>
<pre><span style="color: #cc0000;"><span style="color: #000000;">&lt;response processed_date="2010-03-24T14:37:41+00:00"&gt;
&lt;errors&gt;
	&lt;error code="10"&gt;invalid number or not an integer&lt;/error&gt;
	&lt;error code="9"&gt;invalid number or too short&lt;/error&gt;
&lt;/errors&gt;
&lt;/response&gt;</span>

</span></pre>
<p>Example PHP code:</p>
<pre>&lt;?php
/**
 * POST request on the 'sms' resource (send an SMS)
 */
$url = 'http://www.textmarketer.biz/services/rest/sms';
//$url = 'http://sandbox.textmarketer.biz/services/rest/sms';

$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!

$data = array('message'=&gt;'hello','mobile_number'=&gt;'447777123123', 'originator'=&gt;'me',
	'username'=&gt;$username, 'password'=&gt;$password);
$data = http_build_query($data, '', '&amp;');
// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);
curl_setopt($curlHandle, CURLOPT_POST, 1);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	// do something with the result
	echo "Message ID: $xml_obj-&gt;message_id\n";
	echo "Credits used: $xml_obj-&gt;credits_used\n";

	var_dump($responseBody);

} else {
	// handle the error
	var_dump($responseInfo);
	var_dump($responseBody);
}
?&gt;</pre>
<p><strong>NOTE</strong></p>
<p>It is important to understand the difference between the status of a message in a <a title="Delivery Report" href="/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreport-resource/" target="_self">delivery report</a>, and getting a success or failure when using the API to send a message. A success response from the SMS send only confirms that the number and message appear to be in the correct format &#8211; this does not mean that the number actually exists, or that the message was received by the recipient. Delivery reports, however, confirm to you what has actually happened to the sent message. See the <a title="Delivery Reports" href="/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreport-resource/" target="_self">deliveryReport</a> resource.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1541&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-sms-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST SMS Gateway API &#8211; deliveryReport resource</title>
		<link>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreport-resource/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreport-resource/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:37:15 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1535</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation deliveryReport This document is referred to by the REST SMS Gateway API &#8211; Specification Document. Resource URI: http://www.textmarketer.biz/services/rest/deliveryReport Actions on a specific delivery report. GET method - Gets the contents of a delivery report An individual delivery report shows the current known status of all messages &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreport-resource/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<h2><em><em><strong>deliveryReport</strong></em></em></h2>
<p>This document is referred to by the <a title="API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/">REST SMS Gateway API &#8211; Specification Document</a>.</p>
<p><em><span style="font-style: normal;"><span style="font-weight: normal;">Resource URI:</span></span></em></p>
<pre>http://www.textmarketer.biz/services/rest/deliveryReport</pre>
<p>Actions on a specific delivery report.</p>
<ul>
<li><a title="get method" href="#get">GET method</a> - Gets the contents of a delivery report</li>
</ul>
<p>An individual delivery report shows the current known status of all messages sent on a given day, or for a particular campaign. Whereas the REST API resource <em><a title="deliveryReports resource" href="/blog/2010/06/business-sms/rest-sms-gateway-api-deliveryreports-resource/" target="_self">deliveryReport</a><strong><a title="deliveryReports resource" href="#deliveryReports_resource" target="_self">s</a> </strong></em>(note the trailing s) gets a list of available delivery report names, including delivery reports for campaigns (see <a title="deliveryReports resource" href="/blog/2010/06/business-sms/rest-sms-gateway-api-deliveryreports-resource/" target="_self">here</a>).</p>
<p style="color:white">GET</p>
<p><a id="get"></a><strong><em>GET method</em></strong></p>
<p>Gets the contents of a delivery report &#8211; the status of delivery of sent messages on a given day or for a given campaign.</p>
<p style="padding-left: 30px;">It is important to understand the difference between the status of a message in a delivery report, and getting a success or failure when using the API to <a title="sms resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#sms_resource" target="_self">send</a> a message.</p>
<p style="padding-left: 30px;">A &#8216;success&#8217; response from the SMS <a title="sms resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#sms_resource" target="_self">send</a> only confirms that the number and message appear to be in the correct format &#8211; this does not mean that the number actually exists, or that the message was received by the recipient.</p>
<p style="padding-left: 30px;">Whereas a delivery report &#8211; which you retrieve through this &#8216;deliveryReport&#8217; resource &#8211; confirms to you what has actually happened to the sent message. This may change over time, i.e. a delivery report may not show a status for a given message 10 minutes after the message was sent, but may show a status after an hour. The status of messages can change up to 24 hours after the message was sent. Therefore you may prefer to wait for 24 hours after sending an SMS before trying to retrieve its delivery report.</p>
<p style="padding-left: 30px;">The possible outcomes for a sent message in a delivery report are: DELIVERED,REJECTED,FAILED, &#8220;NON-UK&#8221;  or no report at all.</p>
<ul style="padding-left: 60px;">
<li>REJECTED means that the relevant operator rejected the message and did not attempt to deliver it.</li>
<li>FAILED probably means that the number does exist (or at least not anymore).</li>
<li>DELIVERED means the message was received on the handset.</li>
<li>&#8220;NON-UK&#8221; you are on a UK only route and have tried to send a non UK number.</li>
</ul>
<p style="padding-left: 30px;">Occasionally there is no delivery report status for a given message at all. This can be due to a failure at the operator end because of exceptionally high load or other problems.</p>
<p><strong>Example usage</strong></p>
<pre>http://www.textmarketer.biz/services/rest/deliveryReport/test-190310</pre>
<p>will get the contents of the delivery report named &#8216;test-190310&#8242;. This is the delivery report for the campaign you would have sent named &#8216;test&#8217;.</p>
<p><a title="resource ID" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#resource_identifier">RESOURCE_ID</a>: the name of the delivery report to retrieve</p>
<p><strong>Example GET response</strong></p>
<pre>&lt;response processed_date="2010-03-19T15:24:30+00:00"&gt;
	&lt;report name="test-190310" last_updated="2010-03-19T09:45:04+00:00" extension="csv"&gt;
		&lt;reportrow modified_date="2010-03-19T09:45:00+00:00" mobile_number="447123123456" message_id="12345678"
 status="DELIVERED"/&gt;
		&lt;reportrow modified_date="2010-03-19T09:45:00+00:00" mobile_number="447123123456" message_id="12345679"
 status="DELIVERED"/&gt;
	&lt;/report&gt;
&lt;/response&gt;</pre>
<p>The XML response contains individual reportrow&#8217;s that give the delivery status of an individual message.</p>
<ul>
<li>&#8216;message_id&#8217; is a unique ID for the message that was sent</li>
<li>&#8216;modified_date&#8217; is the last date the delivery status for that message ID was updated</li>
<li>&#8216;mobile_number&#8217; is the number the SMS was sent to</li>
</ul>
<p><a title="REST SMS API DTD specification and  documentation" href="http://www.textmarketer.biz/services/rest/DTD/" target="_self">Read the advanced specification of this response</a>.</p>
<p><strong>Specific error codes</strong></p>
<p><strong></strong>N/A</p>
<p><strong>Note</strong></p>
<p>When we receive a status report from the operator this gets added to a delivery report with a standardised name. The naming format is as follows:</p>
<p>GatewayAPI_DD-MM-YY where DD is the day in the month, MM is the month and YY is the year, each being in a 2-digit format.</p>
<p>So for example:</p>
<pre>GatewayAPI_04-01-09     is valid</pre>
<pre>GatewapAPI_12-12-09     is valid</pre>
<pre>GatewayAPI_1-1-9        is invalid</pre>
<p>Thus to get the delivery report for messages sent on 12th January 2010, you would use the URI:</p>
<pre>http://www.textmarketer.biz/services/rest/deliveryReport/GatewayAPI_12-01-10</pre>
<p><strong>Example PHP</strong></p>
<pre>&lt;?php
/**
 * GET request on the deliveryReport resource
 */
// TODO the URL will change according to the delivery report to retrieve...
$url = 'http://www.textmarketer.biz/services/rest/deliveryReport/myreportname'; // CHANGE THIS!!!
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&amp;password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);

	$reportRows = array();
	foreach ($xml_obj-&gt;report-&gt;reportrow as $xml_reportRow)
	{
		$atts = $xml_reportRow-&gt;attributes();
		$mobile = (string) $atts-&gt;mobile_number;
		$updated = (string) $atts-&gt;last_updated;
		$msgID = (int) $atts-&gt;message_id;
		$status = (string) $atts-&gt;status;
		$reports[] = array('mobile'=&gt;$mobile, 'modified'=&gt;$updated, 'messageID'=&gt;$msgID, 'status'=&gt;$status);
	}
	// do something with the report details
	var_dump($reports);

} else {
	// handle the error
	var_dump($responseBody);
}

?&gt;</pre>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1535&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreport-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST SMS Gateway API &#8211; deliveryReports resource</title>
		<link>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreports-resource/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreports-resource/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:28:16 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1530</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation deliveryReports This document is referred to by the REST SMS Gateway API &#8211; Specification Document. Resource URI: http://www.textmarketer.biz/services/rest/deliveryReports Actions on the list of available delivery reports. GET method - Gets a list of available delivery report names The REST API resource deliveryReports (note the trailing &#8216;s&#8217;) &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreports-resource/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<h2>deliveryReports</h2>
<p>This document is referred to by the <a title="API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/">REST SMS Gateway API &#8211; Specification Document</a>.</p>
<p><em><strong><span style="font-style: normal;"><span style="font-weight: normal;">Resource URI:</span></span></strong></em></p>
<pre>http://www.textmarketer.biz/services/rest/deliveryReports</pre>
<p>Actions on the list of available delivery reports.</p>
<ul>
<li><a title="get method" href="#get">GET method</a> - Gets a list of available delivery report names</li>
</ul>
<p>The REST API resource <em>deliveryReport<strong>s </strong></em>(note the trailing &#8216;s&#8217;) performs actions on the list of available delivery report names, including delivery reports for campaigns.</p>
<p>A delivery report shows the current known status of all messages sent on a given day or for a particular campaign. To access the contents of a particular delivery report &#8211; which will contain the status of individual messages &#8211; you would use the <a title="deliveryReport resource" href="/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreport-resource/" target="_self">deliveryReport</a> resource instead - i.e. no trailing &#8216;s&#8217;.</p>
<p style="color:white">GET</p>
<p><a id="get"></a><em><strong>GET method</strong></em></p>
<p>Get the list of available delivery reports.</p>
<p><strong>Example usage</strong></p>
<pre>http://www.textmarketer.biz/services/rest/deliveryReports</pre>
<p><strong>Example GET response</strong></p>
<pre>&lt;response processed_date="2010-03-19T15:20:49+00:00"&gt;
	&lt;userdirectory&gt;aBcDeFgHiJkLmNoPqRsTuVwZ&lt;/userdirectory&gt;
	&lt;reports quantity="2" &gt;
		&lt;report name="test-190310" last_updated="2010-03-19T09:45:04+00:00" extension="csv"/&gt;
		&lt;report name="GatewayAPI_08-03-10" last_updated="2010-03-08T15:45:02+00:00" extension="csv"/&gt;
	&lt;/reports&gt;
&lt;/response&gt;</pre>
<p><a title="REST SMS API DTD specification and  documentation" href="http://www.textmarketer.biz/services/rest/DTD/" target="_self">Read the advanced specification of this response</a>.</p>
<p>When we receive a delivery report from the operator this gets added to a delivery report with a standardised name. The naming format is as follows: GatewayAPI_DD-MM-YY where DD is the day in the month, MM is the month and YY is the year, each being in a 2-digit format. So for example:</p>
<pre>GatewayAPI_04-01-09     is valid</pre>
<pre>GatewapAPI_12-12-09     is valid</pre>
<pre>GatewayAPI_1-1-9        is invalid</pre>
<p><strong>Specific error codes</strong></p>
<p>N/A</p>
<p><strong>Note</strong></p>
<p>Although it is expected that you will want to use the <em>deliveryReport</em> resource to get the contents of a delivery report, the response as shown above contains all the information necessary to download the delivery reports in csv format, if that is your preferred method. In this case each report can be accessed via the URL</p>
<pre>http://www.textmarketer.biz/DeliveryReports/[dir]/[filename]</pre>
<p>where</p>
<pre>[dir] = the user directory as found in the response above, i.e. in the above example aBcDeFgHiJkLmNoPqRsTuVwZ
[filename] = the name of the csv file to download, e.g. GatewayAPI_08-03-10.csv</pre>
<p>So the complete URL in this example would be:</p>
<pre>http://www.textmarketer.biz/DeliveryReports/aBcDeFgHiJkLmNoPqRsTuVwZ/GatewayAPI_08-03-10.csv</pre>
<p><strong>Example PHP code</strong></p>
<pre>&lt;?php
/**
 * GET request on the deliveryReports resource
 */
$url = 'http://www.textmarketer.biz/services/rest/deliveryReports';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&amp;password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	$atts = $xml_obj-&gt;reports-&gt;attributes();
	$num_reports = (int) $atts-&gt;quantity;

	if ($num_reports &gt; 0)
	{
		echo "$num_reports reports\n";
		$reports = array();
		foreach ($xml_obj-&gt;reports-&gt;report as $xml_report)
		{
			$atts = $xml_report-&gt;attributes();
			$name = (string) $atts-&gt;name;
			$updated = (string) $atts-&gt;last_updated;
			$reports[] = array('name'=&gt;$name, 'modified'=&gt;$updated);
		}
		// do something with the report details
		var_dump($reports);
	} else {
		echo 'No reports available';
	}
} else {
	// handle the error
	var_dump($responseBody);
}
?&gt;</pre>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1530&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-deliveryreports-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST SMS Gateway API &#8211; credits resource</title>
		<link>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-credits-resource/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-credits-resource/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:19:38 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1525</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation credits This document is referred to by the REST SMS Gateway API &#8211; Specification Document. Resource URI: http://www.textmarketer.biz/services/rest/credits Actions on the account credits. GET method - get the number of credits currently available on your account POST method - transfer credits between accounts GET &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-credits-resource/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<h2><em><strong>credits</strong></em></h2>
<p>This document is referred to by the <a title="API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/">REST SMS Gateway API &#8211; Specification Document</a>.</p>
<p>Resource URI:</p>
<pre>http://www.textmarketer.biz/services/rest/credits</pre>
<p>Actions on the account credits.</p>
<ul>
<li><a title="get" href="#get">GET method</a> <em>- </em>get the number of credits currently available on your account</li>
<li><a title="post" href="#post">POST method</a> - transfer credits between accounts</li>
</ul>
<p style="color:white">GET</p>
<p><a id="get"></a><em><strong>GET method</strong></em></p>
<p>Get the number of credits currently available on your account.</p>
<p><strong>Example usage</strong></p>
<pre>http://www.textmarketer.biz/services/rest/credits</pre>
<p><strong>Example GET response</strong></p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-19T15:19:33+00:00"</span>&gt;
&lt;<span class="start-tag">credits</span>&gt;37&lt;/<span class="end-tag">credits</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p><a title="REST SMS API DTD specification and documentation" href="http://www.textmarketer.biz/services/rest/DTD/" target="_self">Read the advanced specification of this response</a>.</p>
<p><strong>Specific error codes</strong></p>
<p>N/A</p>
<p><strong>Example PHP code</strong></p>
<pre>&lt;?php
/**
 * GET request on the 'credits' resource
 */
$url = 'http://www.textmarketer.biz/services/rest/credits';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&amp;password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	$credits = (int) $xml_obj-&gt;credits;
	// do something with the result
	echo $credits;

} else {
	// handle the error
	var_dump($responseBody);
}

?&gt;</pre>
<p style="color:white">P</p>
<p><a id="post"></a><em><strong>POST method</strong></em></p>
<p>Transfer credits from the source/master account to the target/sub account.</p>
<p><strong>Example usage</strong></p>
<pre>http://www.textmarketer.biz/services/rest/credits</pre>
<p><strong>Post arguments</strong></p>
<table border="0">
<tbody>
<tr valign="top">
<td width="100px"><strong>parameter</strong></td>
<td><strong>usage</strong></td>
</tr>
<tr valign="top">
<td>quantity</td>
<td>the number of credits to transfer from the source account to the target account. Must be a positive integer.</td>
</tr>
<tr valign="top">
<td>target</td>
<td>the account number of the account to transfer the credits to (this can be found in the Settings &gt; Account Settings page in the Web interface)</td>
</tr>
<tr valign="top">
<td>username</td>
<td>(optional) required if not using HTTP Digest authentication &#8211; this is the username of the source/master account</td>
</tr>
<tr valign="top">
<td>password</td>
<td>(optional) required if not using HTTP Digest authentication &#8211; this is the password of the source/master account</td>
</tr>
</tbody>
</table>
<p style="color:white">or</p>
<p>OR you can specify the target account user name and password, rather than the target account number</p>
<table border="0">
<tbody>
<tr valign="top">
<td width="100px"><strong>parameter</strong></td>
<td><strong>usage</strong></td>
</tr>
<tr valign="top">
<td>quantity</td>
<td>the number of credits to transfer from the source account to the target account. Must be a positive integer.</td>
</tr>
<tr valign="top">
<td>target_username</td>
<td>this is the username of the target/sub account to transfer credits TO</td>
</tr>
<tr valign="top">
<td>target_password</td>
<td>this is the password of the target/sub account to transfer credits TO</td>
</tr>
<tr valign="top">
<td>username</td>
<td>(optional) required if not using HTTP Digest authentication &#8211; this is the username of the source/master account to transfer credits FROM</td>
</tr>
<tr valign="top">
<td>password</td>
<td>(optional) required if not using HTTP Digest authentication &#8211; this is the password of the source/master account to transfer credits FROM</td>
</tr>
</tbody>
</table>
<p style="color:white">Example POST</p>
<p><strong>Example POST response</strong></p>
<pre>&lt;response processed_date="2010-03-23T10:31:39+00:00"&gt;
	&lt;source_credits_before&gt;1000&lt;/source_credits_before&gt;
	&lt;source_credits_after&gt;900&lt;/source_credits_after&gt;
	&lt;target_credits_before&gt;0&lt;/target_credits_before&gt;
	&lt;target_credits_after&gt;100&lt;/target_credits_after&gt;
&lt;/response&gt;</pre>
<p><a title="REST SMS API DTD specification and documentation" href="http://www.textmarketer.biz/services/rest/DTD/" target="_self">Read the advanced specification of this response</a>.</p>
<p><strong>Specific error codes</strong></p>
<table border="0">
<tbody>
<tr valign="top">
<td width="100px"><strong>Code</strong></td>
<td><strong>Meaning</strong></td>
</tr>
<tr valign="top">
<td>0</td>
<td>there are insufficient credits available to transfer the specified quantity, or the specified quantity is not a positive number</td>
</tr>
<tr valign="top">
<td>1</td>
<td>the target account number specified is not a valid number or username/password combination does not refer to any known account</td>
</tr>
</tbody>
</table>
<p style="color:white">Example XML</p>
<p><strong>Example XML error response</strong></p>
<pre><span><span style="color: #cc0000;"><span style="color: #000000;">&lt;response processed_date="2010-03-24T14:37:41+00:00"&gt;
&lt;errors&gt;
	&lt;error code="0"&gt;Invalid number of credits specified: -1&lt;/error&gt;
	&lt;error code="1"&gt;Invalid destination account number&lt;/error&gt;
&lt;/errors&gt;
&lt;/response&gt;</span></span></span></pre>
<p><strong>Example PHP code</strong></p>
<pre>&lt;?php
/**
 * POST request on the 'credits' resource (credit transfer)
 */
$url = 'http://www.textmarketer.biz/services/rest/credits';
// uncomment for testing:
//$url = 'http://sandbox.textmarketer.biz/services/rest/credits';
$username = 'myAPIusername'; // CHANGE THIS!!! - the username of the account you're transferring FROM
$password = 'myAPIpassword'; // CHANGE THIS!!!
$targetAccountNumber = 0; // CHANGE THIS!!

$data = array('quantity'=&gt;'1',
	'target'=&gt;$targetAccountNumber,
	// or you could use the target username/password instead of 'target'
	// 'target_username'=&gt;$targetUserName, 'target_password'=&gt;$targetPassword,
	'username'=&gt;$username, 'password'=&gt;$password);
$data = http_build_query($data, '', '&amp;');
// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);
curl_setopt($curlHandle, CURLOPT_POST, 1);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	// do something with the result
	echo "Source account credits before: $xml_obj-&gt;source_credits_before\n";
	echo "Source account credits after: $xml_obj-&gt;source_credits_after\n";
	echo "Target account credits before: $xml_obj-&gt;target_credits_before\n";
	echo "Target account credits after: $xml_obj-&gt;target_credits_after\n";
} else {
	// handle the error here
	var_dump($responseInfo);
	var_dump($responseBody);
}
?&gt;</pre>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1525&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/06/sms-gateway/rest-sms-gateway-api-credits-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RESTful Web Services SMS Gateway API Overview</title>
		<link>http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:57:26 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Web to SMS]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[integrate]]></category>
		<category><![CDATA[RESTful]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[sms api]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1107</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation In addition to our simple HTTP SMS Gateway API, explained here, we also provide a &#8216;RESTful&#8217; SMS API to give you access to information about your SMS marketing account (don&#8217;t have one? Create a free account). If you are familiar with REST APIs, &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<p>In addition to our simple HTTP <a title="SMS Gateway API" href="/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">SMS Gateway API</a>, explained <a title="SMS Gateway API" href="/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">here</a>, we also provide a &#8216;RESTful&#8217; SMS API to give you access to information about your <a title="Get an SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/" target="_self">SMS marketing account</a> (don&#8217;t have one? Create a <a title="Free SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/">free account</a>).</p>
<p>If you are familiar with REST APIs, you may wish to jump to our <a title="REST SMS API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/" target="_self">REST API specification document</a>.</p>
<p><strong>WHAT&#8217;S A &#8216;RESTful&#8217; SMS API?</strong></p>
<p>REST is a term used to describe a type of two-way communication via the Internet. It is an architectural style, not a standard, but makes use of well-known web technologies such as <a title="HTTP Protocol" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">HTTP</a>, <a title="XML Language" href="http://en.wikipedia.org/wiki/Xml" target="_blank">XML</a> and <a title="MIME types" href="http://en.wikipedia.org/wiki/Mime_types" target="_blank">MIME types</a>. For more information about REST APIs, read <a title="REST Web Services" href="http://www.xfront.com/REST-Web-Services.html" target="_blank">this great description of REST</a>.</p>
<p>At its most simple, our <a title="RESTful Web Services" href="http://http://www.xfront.com/REST-Web-Services.html" target="_blank">RESTful</a> SMS API allows you to request (&#8216;GET&#8217;) information. For example, from this &#8216;resource&#8217;</p>
<p><a title="REST SMS API resource example" href="http://www.textmarketer.biz/services/rest/credits" target="_blank"><em></em></a><em><a title="Credits resource" href="http://www.textmarketer.biz/services/rest/credits" target="_blank">http://www.textmarketer.biz/services/rest/credits</a> </em></p>
<p>you can access the number of credits available in your account. The response is an XML document that looks like this:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-19T09:37:26+00:00"</span>&gt;
&lt;<span class="start-tag">credits</span>&gt;37&lt;/<span class="end-tag">credits</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p>The SMS REST API is that simple!</p>
<p><strong>WHAT ABOUT SECURITY?</strong></p>
<p>Although it&#8217;s not apparent from the example above, the interface does require authentication using your SMS API account username/password. We provide two ways of passing this information to the server.</p>
<p>The first is via <a title="HTTP Basic Auth" href="http://en.wikipedia.org/wiki/Basic_access_authentication" target="_blank">HTTP Basic Authentication</a>, which is demonstrated by the login box that appears if you click on the resource link above. HTTP Basic authentication can of course be handled within your code. However if you prefer a simpler method, you can pass the parameters via the URL as GET arguments, e.g.</p>
<p><em><a>http://www.textmarketer.biz/services/rest/credits?username=myusername&amp;password=mypassword</a></em></p>
<p>It is also recommended that you use encrypted communication with the REST Web Services by accessing resources via the HTTPS protocol (<em><a>https://&#8230; etc.)</a></em>.</p>
<p><strong>HOW DOES THE RESTful API HANDLE ERRORS?</strong></p>
<p>An advantage of using a RESTful API is that the underlying technologies already do a lot of the work for us. All responses via the HTTP protocol include headers that give us some information about the response. The headers in the above example would look like this:</p>
<pre>Date: Fri, 19 Mar 2010 10:11:40 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 272
Connection: close
Content-Type: application/xml

200 OK</pre>
<p>The MIME type (Content-Type) is set to application/xml which identifies the type of content in the response. It is followed by the response status code &#8217;200&#8242; and the status message &#8216;OK&#8217;. This is a standard response to a successful request.</p>
<p>If we had tried to access a resource which didn&#8217;t exist, e.g.</p>
<p><a title="Bad request" href="http://www.textmarketer.biz/services/rest/anotherResource" target="_blank">http://www.textmarketer.biz/services/rest/anotherResource</a></p>
<p>we would get the following response headers:</p>
<pre>Date: Fri, 19 Mar 2010 10:18:23 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 549
Connection: close
Content-Type: application/xml

404 Not Found :  (ERR101)</pre>
<p>The status code is 404, which is the HTTP protocol&#8217;s standard code for &#8216;resource not found&#8217;. The status message also contains some additional debugging information (ERR91) which you can ignore.</p>
<p>In addition to the status code, the response body contains XML detailing the error. In this example it might look like this:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-24T14:45:54+00:00"</span>&gt;
&lt;<span class="start-tag">errors</span>&gt;
	&lt;<span class="start-tag">error</span><span class="attribute-name"> code</span>=<span class="attribute-value">"404"</span>&gt;Not Found :  (ERR101)&lt;/<span class="end-tag">error</span>&gt;
&lt;/<span class="end-tag">errors</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p>Thus, you can check the header status code for an error code, as well  as the response body.</p>
<p><strong>WHAT RESOURCES CAN I ACCESS THROUGH THE REST SMS API?</strong></p>
<p>At the moment, the resource URIs available to you are:</p>
<ul>
<li><a title="Credits resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#credits_resource"><em>http://www.textmarketer.biz/services/rest/credits</em></a> &#8211; to get the credits available on your account / transfer credits between accounts</li>
<li><a title="deliveryReports resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#deliveryReports_resource"><em>http://www.textmarketer.biz/services/rest/deliveryReports</em></a> &#8211; to list your delivery reports</li>
<li><a title="deliveryReport resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#deliveryReport_resource"><em>http://www.textmarketer.biz/services/rest/deliveryReport/</em>a_report_name</a> &#8211; to access the details of a specific report</li>
<li><a title="sms resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#sms_resource"><em>http://www.textmarketer.biz/services/rest/sms</em></a> &#8211; to send an SMS</li>
<li><em><a title="keywords resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#keywords_resource">http://www.textmarketer.biz/services/rest/keywords</a></em> &#8211; to get the availability of a given keyword (see <a href="http://www.textmarketer.co.uk/shortcode_sms.htm" target="_blank">Short Code SMS Service</a>)</li>
</ul>
<p>More will be added in the future.</p>
<p>Here are 2 walk-through examples for using the REST SMS API.</p>
<p><strong>EXAMPLE REQUEST 1 &#8211; GET CREDITS</strong></p>
<p>Make an HTTP GET request like this:</p>
<p><em></em><em><a>http://www.textmarketer.biz/services/rest/credits?username=myAPIusername&amp;password=myAPIpassword</a></em></p>
<p>Obviously, replace &#8216;myAPIusername&#8217; and &#8216;myAPIpassword&#8217; in the URL with the ones you received when you <a title="Sign up for free SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/" target="_blank">signed up</a>.</p>
<p>When you send this request using your favorite programming language, you should receive the following HTTP <em>headers</em> in response:</p>
<pre>Date: Wed, 24 Mar 2010 15:17:28 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 272
Connection: close
Content-Type: application/xml

200 OK</pre>
<p>Using your programming language, you can easily extract the status code (200 in this case), which indicates success (200) or failure (not 200). The status code of 200 here shows us the request was successful, i.e. the response contains the number of credits in your account.</p>
<p>Thus the HTTP response <em>body</em> that you receive will contain XML similar to this:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-24T15:17:28+00:00"</span>&gt;
&lt;<span class="start-tag">credits</span>&gt;10&lt;/<span class="end-tag">credits</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p>In your programming language you can parse the XML to extract the value of the credits, in this case 10.</p>
<p>But if, for example, you use an incorrect password, the response headers will look like this:</p>
<pre>Date: Wed, 24 Mar 2010 15:30:10 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 377
Connection: close
Content-Type: application/xml

403 Forbidden : Your username/password combination did not match an account. (ERR145)</pre>
<p>The 403 status code shows that an error occurred (all codes except 200 indicate an error). And the XML response body will also contain:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-24T15:29:22+00:00"</span>&gt;
&lt;<span class="start-tag">errors</span>&gt;
	&lt;<span class="start-tag">error</span><span class="attribute-name"> code</span>=<span class="attribute-value">"403"</span>&gt;Forbidden : Your username/password combination did not match an account. (ERR145)&lt;/<span class="end-tag">error</span>&gt;
&lt;/<span class="end-tag">errors</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p><strong>EXAMPLE REQUEST 2 &#8211; SEND SMS</strong></p>
<p>In your programming language, create an HTTP <em>POST</em> request to this URL:</p>
<p><em>http://www.textmarketer.biz/services/rest/sms</em></p>
<p>Since this is a POST request, you cannot pass the username and password via the URL, so you need to use HTTP Digest Authentication, or simply include these parameters along with the other POST parameters you&#8217;ll need:</p>
<ul>
<li>message=&#8217;my message&#8217;</li>
<li>originator=&#8217;me&#8217;</li>
<li>mobile_number=&#8217;447777777777&#8242;</li>
<li>username=&#8217;myAPIusername&#8217; (replace with your own &#8211; or skip this parameter and use HTTP Digest Authentication)</li>
<li>password=&#8217;myAPIpassword&#8217; (replace with your own &#8211; or skip this parameter and use HTTP Digest Authentication)</li>
</ul>
<p>POSTing an HTTP request using the above as POST parameters would send an SMS message of &#8216;my message&#8217; to the mobile number 447777777777 from &#8220;me&#8221;.</p>
<p>NOTE: It will not work to pass these parameters as GET arguments (e.g. by appending them to the URL); this is the principle of a REST API.</p>
<p>Your HTTP POST request should return something similar to the following response headers:</p>
<pre>Date: Wed, 24 Mar 2010 15:17:28 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 272
Connection: close
Content-Type: application/xml

200 OK</pre>
<p>&#8230;the &#8217;200&#8242; status code showing that your request was successful. The HTTP response body will consist of XML containing the ID of the SMS sent as well as the number of credits used to send it:</p>
<pre>&lt;response processed_date="2010-03-23T10:31:39+00:00"&gt;
	&lt;message_id&gt;4172870907&lt;/message_id&gt;
	&lt;credits_used&gt;1&lt;/credits_used&gt;
&lt;/response&gt;</pre>
<p>If, however, there was a problem with your request parameters, for example you set mobile_number to &#8216;garbage&#8217;, you would get similar response headers to this:</p>
<pre>Date: Wed, 24 Mar 2010 15:30:10 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 377
Connection: close
Content-Type: application/xml

404 Bad request</pre>
<p>And the response body would contain XML detailing the precise problems with your request, like this:</p>
<pre><span><span style="color: #cc0000;"><span style="color: #000000;">&lt;response processed_date="2010-03-24T14:37:41+00:00"&gt;
&lt;errors&gt;
	&lt;error code="10"&gt;invalid number or not an integer&lt;/error&gt;
	&lt;error code="9"&gt;invalid number or too short&lt;/error&gt;
&lt;/errors&gt;
&lt;/response&gt;
</span></span></span></pre>
<p>See the <a title="sms resource" href="http://www.textmarketer.co.uk/blog/2010/03/business-sms/rest-sms-api-specification-document/#sms_resource">specification of the sms resource</a> for more details of the possible error codes.</p>
<p><strong>TESTING/SANDBOX</strong></p>
<p>A <a title="Sandbox API" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#sandbox">sandbox service</a> is available for testing your code without changing your account or using any credits.</p>
<p><strong>MORE INFORMATION</strong></p>
<p>For detailed information about our RESTful SMS API, please see our <a title="REST SMS API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/" target="_self">REST  API specification document</a>.</p>
<p>For reference, a list of the DTDs that correspond to the  resources available can be <a title="Web Services DTDs" href="http://www.textmarketer.biz/services/rest/DTD/" target="_blank">found here</a>.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1107&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST SMS API Code Examples</title>
		<link>http://www.textmarketer.co.uk/blog/2010/03/dev/rest-sms-api-code-examples/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/03/dev/rest-sms-api-code-examples/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:56:58 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Development Blog]]></category>
		<category><![CDATA[PHP Classes]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[RESTful]]></category>
		<category><![CDATA[sms api]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1157</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation In our REST API specification document we saw, in general terms, how to make a request to our REST SMS API and how to deal with the response. Here we provide you with some more concrete examples that you can copy &#38; paste! &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/03/dev/rest-sms-api-code-examples/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<p>In our <a title="REST SMS API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/" target="_self">REST API specification document</a> we saw, in general terms, how to make a request to our REST SMS API and how to deal with the response. Here we provide you with some more concrete examples that you can copy &amp; paste!</p>
<p>NOTE: You will want to add additional error checking to the examples below.</p>
<p>In each of the languages used here we create a request, send it, receive the response, and parse its contents.</p>
<p><strong>PHP</strong></p>
<p>Example for getting the number of credits:</p>
<pre>$url = 'http://www.textmarketer.biz/services/rest/credits';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&amp;password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	$credits = (int) $xml_obj-&gt;credits;
	// do something with the result
	echo $credits;

} else {
	// handle the error
	var_dump($responseBody);
}</pre>
<p>Example for getting the list of delivery reports:</p>
<pre>$url = 'http://www.textmarketer.biz/services/rest/deliveryReports';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&amp;password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	$atts = $xml_obj-&gt;reports-&gt;attributes();
	$num_reports = (int) $atts-&gt;quantity;

	if ($num_reports &gt; 0)
	{
		echo "$num_reports reports\n";
		$reports = array();
		foreach ($xml_obj-&gt;reports-&gt;report as $xml_report)
		{
			$atts = $xml_report-&gt;attributes();
			$name = (string) $atts-&gt;name;
			$updated = (string) $atts-&gt;last_updated;
			$reports[] = array('name'=&gt;$name, 'modified'=&gt;$updated);
		}
		// do something with the report details
		var_dump($reports);
	} else {
		echo 'No reports available';
	}
} else {
	// handle the error
	var_dump($responseBody);
}</pre>
<p>Example for getting the details of a particular delivery report:</p>
<pre>// TODO the URL will change according to the delivery report to retrieve...
$url = 'http://www.textmarketer.biz/services/rest/deliveryReport/GatewayAPI_09-02-10';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&amp;password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);

	$reportRows = array();
	foreach ($xml_obj-&gt;report-&gt;reportrow as $xml_reportRow)
	{
		$atts = $xml_reportRow-&gt;attributes();
		$mobile = (string) $atts-&gt;mobile_number;
		$updated = (string) $atts-&gt;last_updated;
		$msgID = (int) $atts-&gt;message_id;
		$status = (string) $atts-&gt;status;
		$reports[] = array('mobile'=&gt;$mobile, 'modified'=&gt;$updated, 'messageID'=&gt;$msgID, 'status'=&gt;$status);
	}
	// do something with the report details
	var_dump($reports);

} else {
	// handle the error
	var_dump($responseBody);
}</pre>
<p>Example for sending an SMS:</p>
<pre>$url = 'http://www.textmarketer.biz/services/rest/sms';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!

$data = array('message'=&gt;'hello','mobile_number'=&gt;'447777777777', 'originator'=&gt;'me',
	'username'=&gt;$username, 'password'=&gt;$password);
$data = http_build_query($data, '', '&amp;');
// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);
curl_setopt($curlHandle, CURLOPT_POST, 1);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
curl_close($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
{
	$xml_obj = simplexml_load_string($responseBody);
	// do something with the result
	echo "Message ID: $xml_obj-&gt;message_id\n";
	echo "Credits used: $xml_obj-&gt;credits_used\n";

	var_dump($responseBody);

} else {
	// handle the error
	var_dump($responseInfo);
	var_dump($responseBody);
}</pre>
<p>Example for transferring credits:</p>
<pre>
<div>&lt;?php</div>
<div>/**</div>
<div> * POST request on the 'credits' resource (credit transfer)</div>
<div> */</div>
<div>$url = '<a href="http://www.textmarketer.biz/services/rest/credits" target="_blank">http://www.textmarketer.biz/services/rest/credits</a>';</div>
<div>// for testing:</div>
<div>//$url = '<a href="http://sandbox.textmarketer.biz/services/rest/credits" target="_blank">http://sandbox.textmarketer.biz/services/rest/credits</a>';</div>
<div>$username = 'myAPIusername'; // CHANGE THIS!!! - the username of the account you're transferring FROM</div>
<div>$password = 'myAPIpassword'; // CHANGE THIS!!!</div>
<div>$targetAccountNumber = 0; // CHANGE THIS!!</div>
<div></div>
<div>$data = array('quantity'=&gt;'1','target'=&gt;$targetAccountNumber,</div>
<div><span>	</span>'username'=&gt;$username, 'password'=&gt;$password);</div>
<div>$data = http_build_query($data, '', '&amp;');</div>
<div>// we're using the curl library to make the request</div>
<div>$curlHandle = curl_init();</div>
<div>curl_setopt($curlHandle, CURLOPT_URL, $url);</div>
<div>curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);</div>
<div>curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);</div>
<div>curl_setopt($curlHandle, CURLOPT_POST, 1);</div>
<div>$responseBody = curl_exec($curlHandle);</div>
<div>$responseInfo  = curl_getinfo($curlHandle);</div>
<div>curl_close($curlHandle);</div>
<div></div>
<div>// deal with the response</div>
<div>if ($responseInfo['http_code']==200)</div>
<div>{</div>
<div> // success - you may want to read in the return data here to see how many credits were  left on each account</div>
<div></div>
<div>} else {</div>
<div><span>	</span>// handle the error here</div>
<div><span>	</span>// var_dump($responseInfo);</div>
<div><span>	</span>// var_dump($responseBody);</div>
<div>}</div>

?&gt;</pre>
<p>For more details on creating <a title="REST requests in PHP" href="http://www.gen-x-design.com/archives/making-restful-requests-in-php/" target="_blank">REST requests in PHP, see here</a>.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1157&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/03/dev/rest-sms-api-code-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP and SMS</title>
		<link>http://www.textmarketer.co.uk/blog/2009/11/sms-gateway/php-and-sms/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/11/sms-gateway/php-and-sms/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 11:35:26 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[sms api]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=742</guid>
		<description><![CDATA[PHP is the very popular web scripting language, to make things easy for the PHP programmer we have provided some (almost!) plug and play  PHP code that easily integrates PHP with our SMS Gateway. Simple Example of sending SMS with PHP This class allows you to send SMS using PHP, &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/11/sms-gateway/php-and-sms/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>PHP is the very popular web scripting language, to make things easy for the PHP programmer we have provided some (almost!) plug and play  PHP code that easily integrates <a title="PHP and SMS Gateway" href="http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">PHP with our SMS Gateway</a>.</p>
<h2>Simple Example of sending SMS with PHP</h2>
<p>This class allows you to send SMS using PHP,  please feel free to modify at will. You just need the username and password from your account login as the constructor arguments. Download <a href="http://www.textmarketer.co.uk/downloads/SendSMSXML.txt">PHP 5 SMS API Class</a></p>
<p>Example:</p>
<pre>$sms = new SendSMSXML("myUsername","myPassword");</pre>
<pre>/// send function args: mobile number, your message, the originator (sender id)</pre>
<pre>$sms-&gt;send("4477777777","my message","me");</pre>
<p>As you can see there is nothing to it!</p>
<p>Take a look at the  more involved document describing how you can integrate <a title="PHP SMS Short Code" href="http://www.textmarketer.co.uk/blog/2009/07/technical/using-our-short-code-and-gateway-apis-to-create-a-game/">PHP with the SMS short code service</a>. This example uses a game where by you text in the number of sweets you think is in a jar. You then receive a response depending on how close you were.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=742&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/11/sms-gateway/php-and-sms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using our short code and gateway APIs to create a game</title>
		<link>http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/using-our-short-code-and-gateway-apis-to-create-a-game/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/using-our-short-code-and-gateway-apis-to-create-a-game/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 15:10:29 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[PHP Classes]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=391</guid>
		<description><![CDATA[The Concept To create an interactive game using Text Messaging and to show how easy it is to create interactive experiences using your Text Marketer Account. The example uses both our short code API (to receive the customer responses) and then our  gateway API to send out the &#8216;answer&#8217;. The &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/using-our-short-code-and-gateway-apis-to-create-a-game/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>The Concept</h2>
<p>To create an interactive game using Text Messaging and to show how easy it is to create interactive experiences using your Text Marketer Account. The example uses both our <a title="shortcode api" href="http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-short-code-api-options/">short code API</a> (to receive the customer responses) and then our  <a title="api spec" href="http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">gateway API</a> to send out the &#8216;answer&#8217;.</p>
<h2>The Game</h2>
<p><span style="font-weight: normal; font-size: 13px;"><img class="size-full wp-image-392 " title="sweets in a jar" src="http://www.textmarketer.co.uk/blog/wp-content/uploads/2009/07/clasp_jar_novelty.jpg" alt="sweets in a jar" width="186" height="220" /></span></p>
<p>Guess the number of sweets in a jar. A simple game where the participant texts in the number of sweets they think is in the jar and then receives a message indicating if they are high,  low , close or have correctly guessed to the number of sweets. <a title="game classes" href="http://www.textmarketer.biz/downloads/game_classes.txt">Download all the required classes</a>.</p>
<h2>Mechanics</h2>
<p style="text-align: center;"><img class="size-full wp-image-407 aligncenter" title="api-flow" src="http://www.textmarketer.co.uk/blog/wp-content/uploads/2009/07/api-flow.jpg" alt="api-flow" width="497" height="367" /></p>
<p>Fig 1 shows the how the basic flow of the systems works. The game is initiated by an incoming text message (as shown in orange) to our 88802 shortcode. The text message contains a keyword  in this case <strong>sweets</strong> and the data you which you need to parse.</p>
<p>Once the text message has been received in your account you can enable a trigger to be sent to your own script residing on your own server. The trigger is a GET request with the parameters added to it as per our short code documentation.</p>
<p>Your application/script can then use the data to geenrate a response. In our case we find out whether the participant has guessed the correct number and we send back an apporprate response using the Text Marketer API  Gateway see documentation for details.</p>
<h2>Creating the game and code examples</h2>
<p>The Guess number of sweets in a jar game and all the code you need can be <a title="game classes" href="http://www.textmarketer.biz/downloads/game_classes.txt" target="_blank">downloaded here</a>. It&#8217;s written in PHP 5.</p>
<p>Once you have created yourself a<a title="free sms account" href="http://www.textmarketer.co.uk/free-bulk-sms-software.htm" target="_blank"> free account</a> you need to request a <a title="free sms short code keyword" href="http://www.textmarketer.co.uk/free-autoresponse-keyword.htm" target="_blank">free shortcode keyword</a> from Text Marketer.</p>
<p>Next <a title="login to fee SMS account" href="http://www.textmarketer.co.uk/campaign/index.php" target="_blank">login into your accoun</a>t and set the url your wish to use for accessing your script. To access the set up screen, select from the menu &#8220;Incoming SMS&#8221; =&gt; &#8220;Change Reply Settings&#8221; then click &#8220;Configure&#8221; next to the keyword. You&#8217;ll then be able to paste the URL into the API URL window. Then press submit.</p>
<p>&nbsp;</p>
<p>The game is broken the code down into 4 classes.</p>
<table border="1">
<tbody>
<tr>
<td><strong>Class Name</strong></td>
<td><strong>Purpose</strong></td>
</tr>
<tr>
<td>SweetsInAJar</td>
<td>The entry point class</td>
</tr>
<tr>
<td>ExtractData</td>
<td>Parse the incoming data &amp; extract the result</td>
</tr>
<tr>
<td>MessageLogic</td>
<td>Game logic and associated response</td>
</tr>
<tr>
<td><a title="sms send class" href="http://www.textmarketer.co.uk/blog/2009/06/technical/php-5-simple-sms-send-class/">SendSMSXML</a></td>
<td>The SMS send class</td>
</tr>
</tbody>
</table>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, fantasy; line-height: 19px; white-space: normal; font-size: 13px;">c</span>lass SweetsInAJar</pre>
<pre>{</pre>
<pre>    function __construct()</pre>
<pre>    {</pre>
<pre>    $sms = new SendSMSXML("myUsername","myPassword");</pre>
<pre>    $theData = new ExtractData("sweets",$_GET['message'],$_GET['number']);</pre>
<pre>    $logic = new MessageLogic();</pre>
<pre>    $logic-&gt;setClosenessRangeInPercent(15);</pre>
<pre>    if($theData-&gt;isValid()){</pre>
<pre>       $sms-&gt;send($theData-&gt;getNumber(),$logic-&gt;getMessage($theData-&gt;getData()),"GuessGame");</pre>
<pre>    }</pre>
<pre>    else</pre>
<pre>    {</pre>
<pre>       $sms-&gt;send($theData-&gt;getNumber(),$logic-&gt;getFailedMessage(),"GuessGame");</pre>
<pre>     }</pre>
<pre>   }</pre>
<pre>}</pre>
<p><strong>Explanation</strong><br />
This is our main class that calls all the relevant objects and class together. Simply the logic works like this:</p>
<ol>
<li>Set up all the objects you need.</li>
<li>Set the closeness to the number of sweets you will need to get before the &#8220;your are close&#8221; message will get sent .</li>
<li>If there is data we can use from the incoming message,  select the correct response and send it.</li>
<li>Otherwise select the &#8220;invalid format message&#8221; and send that.</li>
</ol>
<pre><span>class </span>ExtractData

{
   private <span>$theData</span><span>;</span>
<span>   private </span>$theMobileNumber<span>;</span>
   private <span>$keyword</span><span>;</span>
   private <span>$valid</span><span>=</span>false;
<span><span>	</span></span></pre>
<pre><span>   function </span><span>__construct(</span>$keyword<span>,</span>$message<span>,</span>$number<span>)</span>
   {
<span>      $this</span>-&gt;keyword = <span>$keyword</span>;
<span>      $this</span>-&gt;valid = <span>$this</span>-&gt;getMessageInfo(<span>$message</span>);
<span>      $this</span>-&gt;theMobileNumber = <span>$number</span>;
    }

    public function <span>isValid()</span></pre>
<pre><span>    {<span>		</span></span></pre>
<pre><span><span>       return </span><span>$this</span>-&gt;valid;</span></pre>
<pre><span>     }</span></pre>
<pre><span>     public function <span>getData()</span></span></pre>
<pre><span><span>     {</span></span></pre>
<pre><span><span><span>       return </span><span>$this</span>-&gt;theData;</span></span></pre>
<pre>     }

      public function <span>getNumber()</span>
      {
<span>        return </span><span>$this</span>-&gt;theMobileNumber;
      }

<span>      private function </span>getMessageInfo(<span>$m</span>)
      {
         //remove the keyword and set the result
<span><span>	 </span></span>//remove extra spaces
<span>         $m</span>=trim(<span>$m</span>);</pre>
<pre><span>         $m</span>=str_ireplace(<span>$this</span>-&gt;keyword,<span>""</span>,<span>$m</span>); <span>/// remove keyword</span>
<span>         $m</span><span>=ltrim(</span><span>$m</span><span>); </span>// remove any spaces</pre>
<pre><span>         if</span>(is_numeric(<span>$m</span>)) {</pre>
<pre><span>              $this</span>-&gt;theData = <span>$m</span>;
<span>              return true</span><span>; </span>// is it data?
          }</pre>
<pre>           else return false<span>;</span>
      }

}</pre>
<p><strong>Explanation</strong><br />
This simple class allows us to extract the data we need from the short code response. The response contains the enitre message so we need to remove the keyword and any spaces then check to see if the result is a number.  If it is then the object is &#8220;valid&#8221; else it&#8217;s not valid and we can use this state to send the &#8220;invalid format message&#8221; as described above.</p>
<pre><span>class </span>MessageLogic

{</pre>
<pre><span>    private static </span><span>$lowGuess </span><span>=</span>"Bad Luck! There are more sweets in the jar than you think, try again."<span>;</span>
<span>    private static </span><span>$highGuess</span><span>=</span>"Bad Luck! There are less sweets in the jar than you think, try again."<span>;</span>
<span>    private static </span><span>$correctGuess</span><span>=</span>"Well done! You have guessed the correct amount."<span>;</span>
<span>    private static </span><span>$closeGuess</span><span>=</span>"Close Guess! you are within {value}% of the correct answer."<span>;</span>
<span>    private static </span><span>$badData</span><span>=</span>"We couldn't understand your answer please text in the word SWEETS and your answer, for example SWEETS 300"<span>;</span>
<span>    private </span>$numSweets<span>=</span><span>5678</span><span>; </span><span>//default</span>
<span>    private </span><span>$closenessRange</span><span>=</span><span>5</span><span>;  </span>//5 percent as default 

<span>	</span>
<span>    public function </span>setNumberOfSweets(<span>$value</span>)</pre>
<pre>    {
<span>         $this</span>-&gt;numSweets=<span>$value</span>;
    }

<span>    public function </span>setClosenessRangeInPercent(<span>$value</span>) <span>//in percent</span>
    {
<span>         $this</span>-&gt;closenessRange=<span>$value</span>;
    }

<span>    public function </span>getFailedMessage()</pre>
<pre>    {
         return self<span>::</span><span>$badData</span><span>;</span>
    }

    public  function <span>getMessage(</span><span>$value</span><span>)</span>
    {
         /// some very simple rules
<span>         if</span><span>(</span>$value<span>==</span>$this<span>-&gt;numSweets) </span><span>return self</span><span>::</span>$correctGuess<span>;</span>
<span>         $isClose </span>= round(((abs(<span>$this</span>-&gt;numSweets - <span>$value</span>)) / <span>$this</span>-&gt;numSweets) * <span>100</span>); <span>// calculate how close the number is</span>
<span>         if</span>(<span>$isClose </span>&lt; <span>$this</span>-&gt;closenessRange) <span>return </span>str_replace(<span>"{value}"</span>,<span>$this</span>-&gt;closenessRange,<span>self</span>::<span>$closeGuess</span>);    <span>// if with in the closeness range return close messsage</span>
         else<span>{</span>
<span>              if</span>(<span>$value </span>&gt; <span>$this</span>-&gt;numSweets) <span>return self</span>::<span>$highGuess</span>;
              else return self<span>::</span><span>$lowGuess</span><span>;</span>
         }
     }
}</pre>
<p><strong>Explanation</strong></p>
<p>This is the game logic class, the getMessage function requires the integer that we extracted using the ExtractData class.  There are then some simple rules that select the appropriate message as the returned value.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=391&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/using-our-short-code-and-gateway-apis-to-create-a-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET Examples</title>
		<link>http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/net-examples/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/net-examples/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 11:00:09 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=383</guid>
		<description><![CDATA[Example of a .NET Bulk SMS Gateway / API integration For more information regarding the bulk sending API click here. A simple example for sending SMS via a .NET method Here&#8217;s a stand-alone .Net method: private static string SendSms(string p_userName, string p_password, string p_orig, string p_number, string p_message, bool p_respondInXml) &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/net-examples/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Example of a .NET Bulk SMS Gateway / API integration</h2>
<p><a title="Bulk SMS API" href="http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/" target="_blank">For more information regarding the bulk sending API click here.</a></p>
<p>A simple example for sending SMS via a .NET method</p>
<p><span style="font-family: Arial; font-size: x-small;">Here&#8217;s a stand-alone .Net method:</span></p>
<p><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">private</span><span style="font-family: 'Courier New'; font-size: x-small;"> </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">static</span><span style="font-family: 'Courier New'; font-size: x-small;"> </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">string</span><span style="font-family: 'Courier New'; font-size: x-small;"> SendSms(</span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">string</span><span style="font-family: 'Courier New'; font-size: x-small;"> p_userName, </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">string</span><span style="font-family: 'Courier New'; font-size: x-small;"> p_password, </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">string</span><span style="font-family: 'Courier New'; font-size: x-small;"> p_orig, </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">string</span><span style="font-family: 'Courier New'; font-size: x-small;"> p_number, </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">string</span><span style="font-family: 'Courier New'; font-size: x-small;"> p_message, </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">bool</span><span style="font-family: 'Courier New'; font-size: x-small;"> p_respondInXml) {</span></p>
<p><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">StringBuilder</span><span style="font-family: 'Courier New'; font-size: x-small;"> requestUrl = </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">new</span><span style="font-family: 'Courier New'; font-size: x-small;"> </span><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">StringBuilder</span><span style="font-family: 'Courier New'; font-size: x-small;">();</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">requestUrl.Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;<a href="http://www.textmarketer.biz/gateway/">http://www.textmarketer.biz/gateway/</a>&#8220;</span><span style="font-family: 'Courier New'; font-size: x-small;">);</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">requestUrl.Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;?username=&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">).Append(</span><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">HttpUtility</span><span style="font-family: 'Courier New'; font-size: x-small;">.UrlEncode(p_userName));</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">requestUrl.Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;&amp;password=&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">).Append(</span><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">HttpUtility</span><span style="font-family: 'Courier New'; font-size: x-small;">.UrlEncode(p_password));</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">requestUrl.Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;&amp;orig=&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">).Append(</span><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">HttpUtility</span><span style="font-family: 'Courier New'; font-size: x-small;">.UrlEncode(p_orig));</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">requestUrl.Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;&amp;number=&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">).Append(p_number);</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">requestUrl.Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;&amp;message=&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">).Append(</span><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">HttpUtility</span><span style="font-family: 'Courier New'; font-size: x-small;">.UrlEncode(p_message));</span><br />
<span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">if</span><span style="font-family: 'Courier New'; font-size: x-small;"> (p_respondInXml) {</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">requestUrl.Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;&amp;option=&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">).Append(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;xml&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">);</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">}</span><br />
<span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">WebRequest</span><span style="font-family: 'Courier New'; font-size: x-small;"> webRequest = </span><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">HttpWebRequest</span><span style="font-family: 'Courier New'; font-size: x-small;">.Create(requestUrl.ToString());</span><br />
<span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">WebResponse</span><span style="font-family: 'Courier New'; font-size: x-small;"> webResponse = webRequest.GetResponse();</span><br />
<span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">Stream</span><span style="font-family: 'Courier New'; font-size: x-small;"> responseStream = webResponse.GetResponseStream();</span><br />
<span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">StreamReader</span><span style="font-family: 'Courier New'; font-size: x-small;"> streamReader = </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">new</span><span style="font-family: 'Courier New'; font-size: x-small;"> </span><span style="font-family: 'Courier New'; color: #2b91af; font-size: x-small;">StreamReader</span><span style="font-family: 'Courier New'; font-size: x-small;">(responseStream);</span><br />
<span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">return</span><span style="font-family: 'Courier New'; font-size: x-small;"> streamReader.ReadToEnd();</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;">}</span><br />
<span style="font-family: Arial; font-size: x-small;">And here&#8217;s an example of calling it:</span></p>
<p><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">string</span><span style="font-family: 'Courier New'; font-size: x-small;"> response = SendSms(</span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;MyUsername&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">, </span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;MyPassword&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">, </span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;MyNumber&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">, </span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;4477777777&#8243;</span><span style="font-family: 'Courier New'; font-size: x-small;">, </span><span style="font-family: 'Courier New'; color: #a31515; font-size: x-small;">&#8220;This is a test&#8221;</span><span style="font-family: 'Courier New'; font-size: x-small;">, </span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">true</span><span style="font-family: 'Courier New'; font-size: x-small;">);</span></p>
<p><span style="font-family: 'Courier New'; font-size: x-small;"><br />
</span></p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=383&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/07/sms-gateway/net-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Supported and Unsupported characters in Text Messages &#8211; GSM Character Set</title>
		<link>http://www.textmarketer.co.uk/blog/2009/07/bulk-sms/supported-and-unsupported-characters-in-text-messages-gsm-character-set/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/07/bulk-sms/supported-and-unsupported-characters-in-text-messages-gsm-character-set/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 08:27:09 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[All Bulk SMS Account Documentation]]></category>
		<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Bulk SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[bulk]]></category>
		<category><![CDATA[characters]]></category>
		<category><![CDATA[gsm]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[supported]]></category>
		<category><![CDATA[unsupported]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=345</guid>
		<description><![CDATA[When constructing the message for your SMS Marketing campaign you should be aware that not all characters are supported by the GSM networks. They have a specific character set that they work to. It shouldn&#8217;t be a mjor concern to 99%+ of people as almost all common characters are supported. &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/07/bulk-sms/supported-and-unsupported-characters-in-text-messages-gsm-character-set/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When constructing the message for your SMS Marketing campaign you should be aware that not all characters are supported by the GSM networks. They have a specific character set that they work to. It shouldn&#8217;t be a mjor concern to 99%+ of people as almost all common characters are supported.</p>
<p>For your information here are a list of the supported characters;</p>
<p>&nbsp;</p>
<p>?<a href="http://www.textmarketer.co.uk/blog/wp-content/uploads/2009/07/GSM-7-bit-default-set.jpg"><img class="aligncenter size-full wp-image-2470" title="GSM 7 bit default set" src="http://www.textmarketer.co.uk/blog/wp-content/uploads/2009/07/GSM-7-bit-default-set.jpg" alt="" width="378" height="448" /></a></p>
<p>If you are using our <a href="http://www.textmarketer.co.uk/free-bulk-sms-software.htm">campain bulk sms system</a> then you will be alerted if you use any unsupported characters when you submit the sms campaign.</p>
<p>For <a href="http://www.textmarketer.co.uk/sms-gateway.htm">SMS Gateway</a> customers, you will receive a fail response for any messages submitted with unsupported characters.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=345&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/07/bulk-sms/supported-and-unsupported-characters-in-text-messages-gsm-character-set/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bulk SMS API ASP Help</title>
		<link>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/bulk-sms-api-asp-help/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/bulk-sms-api-asp-help/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 09:54:02 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Documentation]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=303</guid>
		<description><![CDATA[Using standard ASP libraries &#60;% url=&#8221;http://www.textmarketer.biz/gateway/?username=#&#38;password=#&#38;number=#&#38;message=msg&#38;orig=nameORnumber&#38;option=xml&#8221; Set objXMLDoc = CreateObject(&#8220;Microsoft.XMLDOM&#8221;) objXMLDoc.async = False objXMLDoc.load(url) status = objXMLDoc.documentElement.selectSingleNode(&#8220;//response&#8221;).getAttribute(&#8220;status&#8221;) if status = &#8220;success&#8221;  then response.write &#8220;Status &#8221; &#38; status &#38; &#8221; Credits &#8221; &#38; objXMLDoc.documentElement.selectSingleNode(&#8220;//response/credits&#8221;).Text else response.write &#8220;Status &#8221; &#38; status &#38; &#8221; Reason &#8221; &#38; objXMLDoc.documentElement.selectSingleNode(&#8220;//response/reason&#8221;).Text end if %&#62; Put that &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/bulk-sms-api-asp-help/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Using standard ASP libraries</h2>
<div><span style="font-family: Courier; font-size: small;"><span> &lt;%</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> url=&#8221;http://www.textmarketer.biz/gateway/?username=#&amp;password=#&amp;number=#&amp;message=msg&amp;orig=nameORnumber&amp;option=xml&#8221;</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span><br />
</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> Set objXMLDoc = CreateObject(&#8220;Microsoft.XMLDOM&#8221;) </span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span><br />
</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> objXMLDoc.async = False</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> objXMLDoc.load(url)</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span><br />
</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> status = objXMLDoc.documentElement.selectSingleNode(&#8220;//response&#8221;).getAttribute(&#8220;status&#8221;)</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span><br />
</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> if status = &#8220;success&#8221;  then</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> response.write &#8220;Status &#8221; &amp; status &amp; &#8221; Credits &#8221; &amp; objXMLDoc.documentElement.selectSingleNode(&#8220;//response/credits&#8221;).Text</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> else</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> response.write &#8220;Status &#8221; &amp; status &amp; &#8221; Reason &#8221; &amp; objXMLDoc.documentElement.selectSingleNode(&#8220;//response/reason&#8221;).Text</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> end if</span></span></div>
<div><span style="font-family: Courier; font-size: small;"><span> %&gt;</span></span></div>
<p><span style="font-weight: normal; font-size: 13px;">Put that into an ASP page and change the username, password, message and orig in the url string and it will work.  In terms of parsing the XML, this is a useful reference: <a href="http://devguru.com/technologies/xmldom/quickref/xmldom_methods.html">http://devguru.com/technologies/xmldom/quickref/xmldom_methods.html</a>.  This code does not use the .net framework so it will work in both ASP and ASP.NET pages.  The only weakness in the solution above is the fact that there can be multiple reasons for failure, this solution will only take the first reason, but for some, this will be good enough.  To make the code handle this case, the else block would need a loop and you would use <span style="font-family: 'Courier New';">objXMLDoc.documentElement.selectNodes</span> instead of <span style="font-family: 'Courier New';">objXMLDoc.documentElement.selectSingleNode.</span></span></p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=303&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/bulk-sms-api-asp-help/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5 Simple SMS send Class</title>
		<link>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-simple-sms-send-class/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-simple-sms-send-class/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 14:12:12 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[PHP Classes]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=251</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation 2 classes available in php 5, SendSMS and SendSMSXML (recommended) Class Name: SendSMS (depreciated) This class is a nice and easy way to start sending SMS&#8217;s with the Text Marketer system, please feel free to modify at will. You just need the username &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-simple-sms-send-class/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/simple-sms-api.htm">This blog post has been superseded with our website documentation</a></p>
<p><strong>2 classes available in php 5, SendSMS and SendSMSXML (recommended)</strong></p>
<h2>Class Name: SendSMS (depreciated)</h2>
<p>This class is a nice and easy way to start sending SMS&#8217;s with the Text Marketer system, please feel free to modify at will. You just need the username and password from your account login as the constructor arguments.</p>
<p>Download the <a href="http://www.textmarketer.co.uk/downloads/SendSMS.txt">PHP 5 SMS API Class</a></p>
<h2>Example of use</h2>
<pre>&lt;?</pre>
<pre>$sms = new SendSMS("myUsername","myPassword");
if($sms-&gt;send("4477777777","my message","me")) echo "message sent";
else echo "message failed";</pre>
<pre>?&gt;</pre>
<hr />
<h2>Class Name: SendSMSXML</h2>
<p>An updated class from SendSMS which uses the XML response and is simpler to use, please feel free to modify at will. You just need the username and password from your account login as the constructor arguments.</p>
<p>Download <a href="http://www.textmarketer.co.uk/downloads/SendSMSXML.txt">PHP 5 SMS API Class</a></p>
<h2>Example of use</h2>
<pre>&lt;?</pre>
<pre>$sms = new SendSMSXML("myUsername","myPassword");
if($sms-&gt;send("4477777777","my message","me")){</pre>
<pre> <span style="white-space:pre">	</span>echo "I have ".$sms-&gt;getCreditsRemaining()." left and I used  ".$sms-&gt;getCreditsUsed()." credits";</pre>
<pre>}</pre>
<pre>else {</pre>
<pre>     while($error = $sms-&gt;getError())</pre>
<pre>     {</pre>
<pre>         echo $error;</pre>
<pre>     }</pre>
<pre>}</pre>
<pre>?&gt;</pre>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=251&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-simple-sms-send-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5 Delivery Report Helper Class for our SMS Gateway</title>
		<link>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-delivery-report-helper-class/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-delivery-report-helper-class/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 10:16:51 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[PHP Classes]]></category>
		<category><![CDATA[delivery]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=171</guid>
		<description><![CDATA[Class Name: ProcessDeliveryReport This class enables you to access your delivery reports in a nice simplified way. You can search for the outcome of a message for a given number, specify the outcome and the number, download all the data for the given date or parse the reports line by line. &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-delivery-report-helper-class/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Class Name: ProcessDeliveryReport</h2>
<p>This class enables you to access your delivery reports in a nice simplified way. You can search for the outcome of a message for a given number, specify the outcome and the number, download all the data for the given date or parse the reports line by line.</p>
<p>The constructor requires the delivery report directory that is shown in your account. To find your  delivery report directory, log into your system click the menu heading &#8220;Reports&#8221; then select &#8220;Delivery Reporting&#8221;, you will see a green icon, roll over this and you can find the directory name at the bottom.</p>
<p>If you have sent a message greater than 160 characters you will find multiple entries for that particular number . For instance if your message was 200 characters you will find 2 reports for that number. A message is built from 160 chunks</p>
<p>Download the <a href="http://www.textmarketer.co.uk/downloads/ProcessDeliveryReport.txt" target="_blank">PHP 5 Delivery Report Class</a></p>
<h2>Example of use</h2>
<pre>&lt;?

$reports = new ProcessDeliveryReport ( "Kt65CZMtxlIiEU328ilCBgC38" ); // your delivery report directory
if ($reports-&gt;setReportDate ( "20-05-09" )) print_r ( $reports-&gt;findNumber ( "44777777777", "r" ) ); // print the array of results
else echo "Not found";

?&gt;</pre>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=171&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-delivery-report-helper-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5 SMS Send Class implementing listeners on our SMS Gateway</title>
		<link>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-sms-send-class-implementing-listeners/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-sms-send-class-implementing-listeners/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 08:33:07 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[PHP Classes]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[listener]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=167</guid>
		<description><![CDATA[Class Name: SendSMSNotifier This class is designed around the FREE Text Marketer SMS API, you need to sign up here to use it. SendSMSNotifier is a singleton class design, incorporating listeners. Your class must include the following public functions: creditAlert($credits_remaining) and failureAlert($error,$number,$message,$error). Download the class from here Example of use &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-sms-send-class-implementing-listeners/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Class Name: SendSMSNotifier</h2>
<p>This class is designed around the FREE Text Marketer SMS API, you need to sign up here to <a href="http://www.textmarketer.co.uk/free-bulk-sms-software.htm" target="_blank">use</a> it.</p>
<p>SendSMSNotifier is a singleton class design, incorporating listeners. Your class must include the following public functions: creditAlert($credits_remaining) and failureAlert($error,$number,$message,$error).</p>
<p>Download the class from <a href="http://www.textmarketer.co.uk/downloads/SendSMSNotifier.txt" target="_blank">here</a></p>
<h2>Example of use</h2>
<pre>class MyTestClass
{</pre>
<pre>        /// simple array of data in: number, message, sender Id (aka originator) format, ideally the data will come from a database
	private $mySMSdata = array(array("44777777777","Hello World!","Me"),
			                             array("text","This will throw an error, mobile number is text","Me"));

	function __construct()
	{
		$sms = SendSMSNotifier::getInstance("myUsername","myPassword"); // your account login details
		$sms-&gt;addListener($this); // Your class gets added to the listeners that will get notified on an event
		$sms-&gt;setCreditThreshold(5); // You want o be notified when you have 5 credits left

		foreach($this-&gt;mySMSdata as $record) // send some data
		{
			list($number,$message,$sender) = $record;
			$sms-&gt;send($number,$message,$sender); // send to the api
		}
		echo $sms-&gt;getCredits();
		print_r($this-&gt;errors);
	}

	public function failureAlert($error,$number,$message,$originator)
	{
		/// Required function for failure messages, you could stop the sending here or log the results
		$this-&gt;errors[] = array($error,$number,$message,$originator);
	}

	public function creditAlert($credits)
	{
		/// Required function for credit alerts, this basic implementation stops sending anymore SMS's
		die("I have nearly run out of credits($credits left), abandon sending!");
	}
}</pre>
<p>So here&#8217;s what happens. You send a bunch of text messages to the gateway using your class (in this example MyTestClass), if you get a failure such as a badly formatted number your function <strong>failureAlert</strong> gets called with the parameters of the failure and data, you can then decide on the implmentation. In the above example it just stores them in an array, once you have sent all the data you could then use the data to clean your database etc.</p>
<p>If the credit limit (in the above case this is 5 $sms-&gt;setCreditThreshold(5) ) your function <strong>creditAlert</strong> will get called, in this case we think this is bad so we use the hammer of the <strong>die()</strong> function to stop the sending, obviously you would handle this much more elegantly :-)</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=167&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/06/sms-gateway/php-5-sms-send-class-implementing-listeners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

