Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Database Question

Options
  • 03-09-2007 3:53pm
    #1
    Registered Users Posts: 1,151 ✭✭✭


    Hello everyone. I am a non-professional web designer that nerded out and got on well enough with the adobe CS packages to do some low level web work for some of my clients. I do have one small problem that I need assistance with. I have no problem creating forms but I do not know enough about CGI scripting, PHP and Perl to be able to solve this simple conundrum.

    Basically I want to be able to collect mobile numbers from a form on a website and put them into a file that either can be converted easily for use with clickatell.com's SMS gateway software or that will directly appear formatted in a compatible manner that can be amalgamated easily with a list that will be compiled manually.

    Being a person who made the mistake of allowing myself to indulge in the alluring legend of working for one's self I am on my own and need to make this happen asap for two clients which means a lot more will want it two.

    So basically, is there such things as an easy to install package that can do this for me available at low cost or is there an individual here or elsewhere who can create this for me for suitable compensation that can be recommended.

    Alternatively, is this as something I can learn to do myself and where is the best place to learn the art of online database systems.

    Thank you in advance for any help you can give!


Comments

  • Closed Accounts Posts: 270 ✭✭CoNfOuNd


    Try one of the PHP, Perl or Ruby APIs on their website at:

    http://www.clickatell.com/solutions/developers/scripts.php

    Might save you money.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    What you want to do is essentially two things:
    1. Validate / format numbers that people enter into your form into a standard MSISDN format
    2. Store the resultant MSISDN
    For the former you should be able to find a script online that will do this for you.

    In the case of the latter it depends on exactly what you need. All you might want is to append the MSISDN to a text file on your server - if so there are scripts out there for that too, which you would amend to format entries so that they can be used with one of Clickatell's various API's.


  • Registered Users Posts: 3,401 ✭✭✭randombar


    Here's the code to do a simple number check:
    if ((!(preg_match('/^084|^085|^086|^087/', $phone)))||(strlen($phone)!=10)) {
    
     $block=1;
     print "<script>";
     print " alert(\"The mobile phone number must be 10 numbers and in the form 08xxxxxxxx not ".strlen($phone)." characters and the form ".$phone."\");";
     print " self.location='register.php?name=$name&address=$oldaddress&email=$email&user=$user';";
     print "</script>";
     
    }
    

    And a very simple php clickatell script:
    $user = "username";
    $password = "password";
    $api_id = "appid";
    $baseurl ="http://api.clickatell.com";
    $text = urlencode("Text message you want to send");
    $to = $phone;
    // auth call
    $url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
    // do auth call
    $ret = file($url);
    // split our response. return string is on first line of the data returned
    $sess = split(":",$ret[0]);
    if ($sess[0] == "OK") {
    $sess_id = trim($sess[1]); // remove any whitespace
    $url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
    // do sendmsg call
    $ret = file($url);
    $send = split(":",$ret[0]);
    if ($send[0] == "ID")
    {//echo "success message ID: ". $send[1];
    }
    else
    {echo "send message failed";}
    } else {
    echo "Authentication failure: ". $ret[0];
    exit();
    }
    


Advertisement