0

Hi Everyone.

Could anyone give me some pointers in creating a PHP, MySQL ShortCode system.
I want to create a system where a user can SMS a keyword to a short code SMS number.

Example: SMS pizza to 33333.

Then the server checks pizza in MySQL DB and replies with top 5 pizza places.

Regards

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by MooGeek
1

Well you'll need to find a way to get the short code SMS to communicate with your PHP script. I have no idea how to do this. When it comes to the PHP, it seems easy enough.

switch(strtolower($_GET['command'])) {
    case 'pizza':
        $r = mysql_query("SELECT * FROM pizza ORDER BY popularity DESC LIMIT 5");
        if(mysql_num_rows($r) != 0) {
            while($arr = mysql_fetch_array($r)) { echo $arr['name']; }
        } else { echo "No pizzas found. Sry!"; }
        break;
}

This would work assuming you have already connected to your database and your table structure is similar to my little demo. You would also need to have texts to the number routed to your script, assuming the command parameter contains the contents of the text and the stdout is returned to the sender of the text message.

Edited by FlashCreations: n/a

1

To get from SMS to your server you will need to use an SMS gateway service (and you will need to pay for it). That will allow you to go in both directions.
One example: ClickaTell

At no cost, you can go from the server to SMS if you have the phone number and know the cell phone provider (and the SMS email address format for that specific provider).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.