Hello World Bot?

Jacob 's Avatar

Jacob

25 May, 2010 05:56 PM via web

Hi, I'm having problem with setting up my bot. I used the :

"<?php switch ($REQUEST['step']) {
case 1:
echo "Hi, what's your name?";
break;
case 2:
echo "Hi " . $
REQUEST['value1'] . ", where do you live?";
break;
case 3:
echo "Well, welcome to this hello world bot, " . $REQUEST['value1'] . "
from " . $
REQUEST['value2'] . ".";
break;
} ?>

"

code and put it on my server 777'ed it and everything but when I message my bot it gives me the error:
"Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home/hdriveca/hdrive.ca/hdrivebot/phpscript.php on line 8

Parse error: syntax error, unexpected T_SWITCH in /home/hdriveca/hdrive.ca/hdrivebot/phpscript.php on line 9"

What did i do wrong?

  1. 2 Posted by bk.chien on 26 May, 2010 02:49 AM

    bk.chien's Avatar

    $_REQUEST , not $REQUEST

  2. 3 Posted by sudansh.singh on 26 May, 2010 04:38 AM

    sudansh.singh's Avatar

    I tried similar sample code and entered Bot URL as
    "http://pastebin.com/raw.php?i=dqvm3vq5" Here's the code
    <?php
    $command = explode(” “, $_REQUEST['msg']); if($command[0] == ‘hi’)
    { echo “Welcome thanks for adding me :) “;
    }else if($command[0] == ‘bye’) echo “Bye hope to receive hi from you again :) “;
    }else{ echo “Hey I do not understand the language speak english plz :( “;
    } ?>

    But then when I used the debugger, every time I enter anything it just returns the full PHP code to me.Please help.What have I done wrong?

  3. 4 Posted by bk.chien on 26 May, 2010 05:33 AM

    bk.chien's Avatar

    replace “ by "
    replace ‘ by '

    new code :

    <?php
    $command = explode(" ", $_REQUEST['msg']); if($command[0] == 'hi') echo "Welcome thanks for adding me :) ";
    else if($command[0] == 'bye') echo "Bye hope to receive hi from you again :)";
    else echo "Hey I do not understand the language speak english plz :( ";
    ?>

  4. 5 Posted by sudansh.singh on 26 May, 2010 07:54 AM

    sudansh.singh's Avatar

    Here is my new Bot URL.. http://pastebin.com/raw.php?i=qQfS4ST5
    Even debugging this also gives me whole PHP code as output. Every sample program I get from net, I just get the whole PHP code as output.
    Please help, I am not even able to start up

  5. 6 Posted by Jacob Downey on 27 May, 2010 12:10 AM

    Jacob Downey's Avatar

    How do you add more responses to your bot and make it smarter could you give me a larger sample code with multi step answers etc nothing to fancy just something to start me up? It would be really helpful! thanks

  6. 7 Posted by sudansh.singh on 27 May, 2010 08:28 AM

    sudansh.singh's Avatar

    Here is my new Bot URL.. http://pastebin.com/raw.php?i=qQfS4ST5
    Even debugging this also gives me whole PHP code as output. Every sample program I get from net, I just get the whole PHP code as output.
    Please help, I am not even able to start up
    please help me someone...what wrong m i doing?

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.