利用するcURL
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://sms.xyz.com/uname=abc&pass=xyz&phone=1234567890&msg=hello");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // For HTTPS
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // For HTTPS
curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Returns 200 if everything went well
if($statusCode==200)
{
echo "<script>alert('SMS Sent');</script>";
echo "<script>document.location.href='welcome.html'</script>"; //Redirecting back after successfully sent SMS
}
else
{
echo "<script>alert('SMS Sending Failed.');</script>";
}
curl_close($ch);