CodeIgniter Forums
http request for an SMS API - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: http request for an SMS API (/showthread.php?tid=30711)



http request for an SMS API - El Forum - 05-24-2010

[eluser]TornUp[/eluser]
Hi all,

Im currently working on a user signup system for a nightclub events company, and it is required to verify their data.

this done by a simple "e-mail activation"(nothing new there!)
and
A SMS activation.

we use a company called trinitymobile.co.uk for all our SMS marketing, and they have an API for sending SMS messages.

The problem im facing, is how do i get my CI code to fire off a HTTP request to the API?

The API is as follows:

http://appserver.trinitymobile.co.uk/messaginginterfaces/a.msg?Command=SendMessage&UserName=usernam
e&Password=password&MSISDN=msisdn&CostCentre=costcentre&CampaignName=campaignname&Brand=br
and&Originator=originator&Channel=channel&Message=message&TrackingId=trackingId

it all looks pretty simple, and i seem to understand how to populate the bits i need with the infomation i wish to send.... i just don't know how to post it..

could somone help me with the code?

many thanks!

Tom Kirby.


http request for an SMS API - El Forum - 05-24-2010

[eluser]mjsilva[/eluser]
Just use Curl Library http://codeigniter.com/wiki/Curl_library/ by Phil Sturgeon

And do something like this:

Code:
$url = 'http://appserver.trinitymobile.co.uk/messaginginterfaces/a.msg?Command=SendMessage&UserName=usernam
e&Password=password&MSISDN=msisdn&CostCentre=costcentre&CampaignName=campaignname&Brand=br
and&Originator=originator&Channel=channel&Message=message&TrackingId=trackingId';

$response = $this->curl->simple_get($url);



http request for an SMS API - El Forum - 05-24-2010

[eluser]TornUp[/eluser]
perfect! Smile

thought it would be a simple task! heh

im guessing that because you have assigned "$this->curl->simple_get($url)" to $response, that the CURL library returns a response for validation?

many thanks mjsilva!


http request for an SMS API - El Forum - 05-24-2010

[eluser]mjsilva[/eluser]
Yes, in $response you should get the response of your request and then you can validate it.


http request for an SMS API - El Forum - 06-18-2010

[eluser]Unknown[/eluser]
hii,


This is the HTTP Request to send the message "The medium is the message" to user "12432". ... Here are the the required parameters in the HTTP POST request.



Ladies Designer Clothing