For a particular PHP script I'm working on, I'm going to use a system call to the Lynx web browser to convert HTML to plain text and capture the output:
$text = `lynx -dump stackoverflow.com`;
/*
#[1]Stack Overflow [2]RSS
[3]login | [4]about | [5]faq
____________________________
[6]logo homepage
* [7]Questions
* [8]Tags
* [9]Users
* [10]Badges
*/
What I'd like to do however, is fallback gracefully onto a different method in case Lynx isn't available on the server. How do you check if a program exists in your PATH? Oh, and it needs to work on both Windows and Linux... :p
I'm not writing a SO screen scraper, don't worry...