I'm reading a great book called - Webbots Spiders & Screen Scrapers-A Guide to Developing Internet Agents with PHPCURL. It looks very good but doesn't tell you how to do some basics. For example, it says: "Before we can execute the example (Downloading Files with fopen() and fgets()) , we need to examine the two ways to execute a webbot: You can run a webbot either in a browser or in a command shell. Problem is, it doesn't tell you how to do either. From what I understand, executing in a command shell is preferable. But how do I do that? Do I do it from my pc or my webhost (or both)? Please could someone explain this to me, or link to a good tutorial on this kind of basic. Suprisingly, the rest of the book seems to be aimed at beginners, so this is a strange oversight by the writer. If you're interested, it's worth a read.
You need SSH access on your hosting to do that. Or if you are coding on local PC, you can run script in console(cmd for Windows). http://www.php.net/manual/en/features.commandline.usage.php
You can wrap commands in backticks `commands go here` or use exec to do stuff in command line. Or, you can just run a php script from the command line itself. If you're in Windoze, you can open a command prompt. Go to the folder where the script is located (something written that doesn't need Apache to run), and then type php.exe scriptname.php
Thanks. Unfortunately, I need things step-by-step. I use php and can find my way around it pretty well. Mostly copying and pasting, admittedly, but it's effective. Unfortunately, I don't have the conceptual background so I get lost very quickly when I need to do something new.
Hey, thanks again. I have a pc at home with Windows vista but I also have hostgator reseller hosting with cpanel. Also, could someone tell me how to 'thank' or 'like' on this forum. Since it was redesigned I haven't figured out how to be 'polite' properly : )
Run command line first(Win+R -> cmd). Then type next command: [PATH_TO_YOUR_PHP]\php.exe -v Code (markup): For example: "C:\Program Files\PHP\php.exe -v". If it will give you output with php version that means everything is right. In other case you typed wrong path to php.
Thanks again. I entered the path to my xampp installation, where there is a php.exe file. It returned with the php version so I'm guessing that means all is ok? Does this activate php in the command shell? Do I now just type in the scripts - or can I paste them in in some way? Many thanks.
Now you can use next syntax to run php script: [PATH_TO_YOUR_PHP]\php.exe [PATH_TO_YOUR_SCRIPT]\filename.php Code (markup):
That worked. Thanks! Now I can run the scripts from the book. That's great. Thanks to everyone for your help - and especially IGarret.