PHP 7 Script to Send SMS to Mobile Number Using Twilio SMS API Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments


Welcome folks today in this blog post we will be sending sms to mobile number using twilio sms api in php 7.All the full source code of the application is shown below.




Get Started




In order to get started you need to make an index.php file and copy paste the following code

See also  PHP 7 Script to Compress Files and Directories and Download a ZIP,RAR File Using Ziparchive Class in Browser Full Project For Beginners






function send_twilio_sms($id, $token, $from, $to, $body)
$url = "".$id."/SMS/Messages";
$data = array (
    'From' => $from,
    'To' => $to,
    'Body' => $body,
$post = http_build_query($data);
$x = curl_init($url );
curl_setopt($x, CURLOPT_POST, true);
curl_setopt($x, CURLOPT_RETURNTRANSFER, true);
curl_setopt($x, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($x, CURLOPT_USERPWD, "$id:$token");
curl_setopt($x, CURLOPT_POSTFIELDS, $post);
$y = curl_exec($x);
return $y;

Leave a Reply