Thank you Bogu, that was very helpful actually. I'm sure it'll come in handy for me later. But as it turns out all i needed to do was
exec("expect blah.exp");
instead of
exec("blah.exp");
Now I have another problem, but I think it might be a permission access problem. The script that I run has to move a file from /tftpboot directory into my home directory. When I run the script in command line, it moves the file fine. However, when I run the same script using PHP, it doesn't move the file. The file is actually in /tftpboot directory but it doesnt get moved into my home. Is this because Apache doesn't have access to /tftpboot?
Thx!