Hello World Bot?
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?
2 Posted by bk.chien on 26 May, 2010 02:49 AM
$_REQUEST , not $REQUEST
3 Posted by sudansh.singh on 26 May, 2010 04:38 AM
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?
4 Posted by bk.chien on 26 May, 2010 05:33 AM
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 :( ";
?>
5 Posted by sudansh.singh on 26 May, 2010 07:54 AM
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
6 Posted by Jacob Downey on 27 May, 2010 12:10 AM
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
7 Posted by sudansh.singh on 27 May, 2010 08:28 AM
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?