Return to Snippet

Revision: 68784
at February 26, 2015 22:27 by Afilnet


Updated Code
<?
    // Register in http://www.afilnet.com/anunciante/registrar.php
    // Login and get credits (10 free)
    // Use this script or form include in download link:
    // http://www.afilnet.com/programacion/sms/PHP/HTTP/examples/send-simple-sms.zip

    $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 test of sms sending"; // 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

    # http request
    $response = file_get_contents($url); 
    if($response) { 
        switch($response) { 
            case "OK": 
                echo "SMS sent successfully";  
                break; 
            case "-1":  
                echo "Error in login, email or password is wrong"; 
                break; 
            default:  
                echo "You have no credits";
        } 
    } else { 
        echo "Error in request"; 
    } 
?>

Revision: 68783
at February 23, 2015 23:22 by Afilnet


Initial Code
<?
    // Register in http://www.afilnet.com/anunciante/registrar.php
    // Login and get credits (10 free)
    // Use this script or form include in download link:
    // http://www.afilnet.com/programacion/sms/PHP/HTTP/examples/send-simple-sms.zip

    $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 test of sms sending"; // 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

    # http request
    $response = file_get_contents($url); 
    if($response) { 
        switch($response) { 
            case "OK": 
                echo "SMS sent successfully";  
                break; 
            case "-1":  
                echo "Error in login, email or password is wrong"; 
                break; 
            case "Sin creditos":  
                echo "You have no credits"; 
                break; 
            default: 
                echo $response; 
        } 
    } else { 
        echo "Error in request"; 
    } 
?>

Initial URL
http://www.afilnet.com/programacion/sms/PHP/HTTP/examples/sendsimplesmsform.php

Initial Description
Simple script to send SMS throught our HTTP API (Afilnet) with PHP. Steps:
1.- Register in Afilnet. http://www.afilnet.com/anunciante/registrar.php
2.- Login and get credits (10 free) to send SMS
3.- Use this script or html form example include in this download link: http://www.afilnet.com/programacion/sms/PHP/HTTP/examples/send-simple-sms.zip

Initial Title
Send simple SMS with PHP

Initial Tags
form, php, html

Initial Language
PHP