Send simple SMS with PHP
Join the DZone community and get the full member experience.
Join For Free
/*
Steps to use this script:
1- Register in Afilnet. http://www.afilnet.com/anunciante/registrar.php
2- Login Get credits (10 free)
3- Use this script
*/
$email = "EMAIL"; // Afilnet's email
$pass = "PASS"; // Afilnet's password
$mobile = "DESTINATION"; // mobile target
$idsender = "SENDER"; // sender, 11 characters max
$prefix = "PREFIX"; // country prefix
$sms = "this is a sending test"; // sms text
$url = "http://www.afilnet.com/http/sms/?email=".$email."&pass=".$pass."&mobile=".$mobile."&id=".urlencode($idsender)."&country=".$prefix."&sms=".urlencode($sms); // request url
# Request
$response = file_get_contents($url);
if($response) {
switch($response) {
case "OK":
echo "SMS sent successfully";
break;
case "-1":
echo "Login error, email or password is wrong";
break;
default:
echo "You have no credits for sending";
}
} else {
echo "Request error";
}
?>
SMS
PHP
Opinions expressed by DZone contributors are their own.
Comments