The SMS gateway that he was using didn’t had that meaningful documentation.After planning on how do I connect to the SMS Gateway , I decided to use PHP cURL.
PHP cURL is a very efficient and powerful library that allows you to connect and communicate to different servers.For more information on cURL visit http://www.php.net//manual/en/book.curl.php .
The below code connects to the SMS gateway and then sends the message.
$url = "http://smsurl/sms1"; // URL of the SMS Gateway $curl_connection = curl_init($url); //Initialize curl handle curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); //Set the post variables like username , password , sms text etc. $result = curl_exec($curl_connection); //run the whole process and return the response curl_close($curl_connection); //close the curl handle
In the above code first the connection to the SMS Gateway is made.
Then the variables like username,password etc is passed.
These parameters and url are given by the SMS Gateway Provider.
The URL is then executed and finally the connection with the Gateway is closed.