cURL Script

cURL Scripts [HTTP API]

Use the cURL/PHP script below to send SMS. You can modify this basic script to your requirements.


function get_web_page( $url )
{
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
);

$ch = curl_init( $url );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );

return $content;
}

$user = "941234567890";
$password = "1234";
$text = urlencode("This is an example message");
$to = "94000000000";

$baseurl ="http://www.textit.biz/sendmsg";
$url = "$baseurl/?id=$user&pw=$password&to=$to&text=$text";
$ret = get_web_page($url);
$res= explode(":",$ret);

if (trim($res[0])=="OK")
{
echo "Message Sent - ID : ".$res[1];
}
else
{
echo "Sent Failed - Error : ".$res[1];
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *