World
Text
Friday 21st of November 2008
Home
Support
About Us
Contact Details
FAQ
New Ticket
SMS Tracking
Search
Services
An Overview
Bulk SMS
Consultancy
Development
Email To SMS
Incoming SMS
Interfaces & APIs
Bulk Email
Email
HTTP
SMPP
Organisations
Paging by SMS
Sub Accounts Solutions
SMPP Connections
Web SMS
Software
Desktop SMS
SMPP Link Tester
WorldText
Third-party
Pricing
Current Prices
Coverage
Login
Login
Register
Demo
Information
Coverage
Dialing Codes
SMPP
Email Gateway
SMTP Bulk API
Paging System
Terms
SMS Status
Code Samples
Latest News
New HTTP/S Interface, Delivery Report Callback, Group Management & Dispatch and more.
Send SMS Demo
Mobile Number
Enter the code shown
HTTP Interface With PHP Example
Home
/
Example Code
function doPostRequest( $host, $port, $uri, $body ) { $url = "http://$host:$port/$uri"; $ch = curl_init(); // set the target url curl_setopt($ch, CURLOPT_URL,$url); // howmany parameter to post curl_setopt($ch, CURLOPT_POST, 1); // the parameter 'username' with its value 'johndoe' curl_setopt($ch, CURLOPT_POSTFIELDS,"$body"); // Return the data rather than printing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec( $ch ); curl_close( $ch ); return $result; } function sendSMS( $username, $password, $mobile, $message, $srcaddr = "World-Text" ) { $message = urlencode( $message ); $result = doPostRequest( "sms.world-text.com", 1081, "sendsms", "username=$username&password=$password&sourceaddr=$srcaddr&mobile=$mobile&message=$message" ); return $result; } sendSMS( "username", "password", "44777111222", "Hello this is a PHP SMS Test from World-Text using the HTTP Interface", "SMSAlert" );