Posts Tagged ‘php5-cli’

Web Spider using php cli

May 7th, 2009 No comments

Purely on academic basis, I had once helped to cook up a web spider, which is used to build site maps. The spider was written in php and uses a couple of reg-exp matches, and finally writes the full sitemap from the start url. The system is assembled using two classes, WebPage and WebSpider. Then to make it similar to linux utilities in the command line environment, some functions were scooped in.
Read more…

Categories: Code Snippets Tags: ,

User input in php command line

January 17th, 2007 10 comments

Ever wondered how to capture the user input when writing php command line scripts ?

function getInput($msg){
fwrite(STDOUT"$msg: ");
$varin trim(fgets(STDIN));

The function above is being used by me in certain command line scripts, where I need user responses.