$user = "94123456789"; $password = "0000"; $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 = file($url); $res= explode(":",$ret[0]); if (trim($res[0])=="OK") { echo "Message Sent - ID : ".$res[1]; } else { echo "Sent Failed - Error : ".$res[1]; }
Tip : If you get blank response from the api, it may be possible that your hosting provider is blocking external file access.
In such events you should use cURL Script given Below.