Jesper Petersen
Jesper Petersen

Reputation: 27

send SMS from website

I have google around and try to see if I could find something php server where you can see it on to mobile etc.. I have read me until that one must have an API code before you can do it.

Hope you can help me

Feel free to ask me if there's anything else you want to know?

i have to try its here:

// Create a Clockwork object using your API key
$clockwork = new Clockwork( $key );

// Setup and send a message
$message = array( "to" => "441234567890", "message" => "Hello World" );
$result = $clockwork->send( $message );

// Check if the send was successful
if( $result["success"] ) {
    echo "Message sent - ID: " . $result["id"];
} else {
    echo "Message failed - Error: " . $result["error_message"];
}

I can in no way get it to work at all. it does not send any SMS. and is download from here: http://www.clockworksms.com/

I have no api and I do not go out and make money for it. it is such that I come from Denmark,.

EIDT! :

function sms_server()
    {
        $number = $_POST["mobil"];
        $tekst = $_POST["tekst"];
        $clockwork = new Clockwork("785c853......");

        $message = array( "to" => $number, "message" => $tekst);
        $result = $clockwork->send( $message );

        if( $result["success"] ) {
            echo "Message sent - ID: " . $result["id"];
        } else {
            echo "Message failed - Error: " . $result["error_message"];
        }
    }


<form action="#" method="post">
            <table width="100%">
                <tr>
                    <td>nummer</td>
                    <td><input type="number" name="mobil"></td>
                </tr>
                <tr>
                    <td>Tekst</td>
                    <td><textarea name="sms" style="width:100%;"></textarea></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="submit" name="send" value="Send sms"></td>
                </tr>
            </table>
        </form>
        <?php
        if(isset($_POST["send"]))
        {
            $sms_server = $mebe->sms_server();
        }
        ?>

Upvotes: 0

Views: 1343

Answers (2)

TINOSHI
TINOSHI

Reputation: 1

replace $tekst = $_POST["tekst"];

with this code

$tekst = $_POST["sms"];

and create account with clockwock to get AP-KEY

Upvotes: 0

adaam
adaam

Reputation: 3706

Have you signed up for an API key - it seems that having an API key is a must for use of this! (https://app5.clockworksms.com/signup). You will need to assign the API key they give you to your $key variable. Also if you're from Denmark, I'm really not sure that this will work for you as UK mobile numbers are used as examples in their documentation, although I am not sure(?). Actually possibly it'll be fine if you prefix your mobile number with the danish country code

Upvotes: 2

Related Questions