Loans - Gas Suppliers - Job Listing - Debt Help - Online Advertising

PDA

View Full Version : PHP Word Finding....


Arson
Dec 3rd 2007, 8:50 pm
I am wondering if there is any kind of command in PHP that will search a web page for a certain word, and then confirm whether or not the word was found.

For example, say I wanted to find the word "ebay" on www.ebay.com, the script would look for it, and then it would come back and tell me, yes, the word ebay is on www.ebay.com!

Or, if I wanted to find the word "Microsoft" on a linux enthusiast website, it would search the site, and come back and tell me hey, the word "microsoft" was not found on that linux enthusiast site..

So, is there any special command or whatnot that would allow me to do this?

Arson
Dec 3rd 2007, 10:41 pm
Ok I have figured out that its cURL. And there is a way to do it so the site thinks its a google bot.

I am willing to hire someone to make me a script like what I described in my first post, using cURL

ognos
Dec 4th 2007, 10:39 am
use also preg_match_all

f.e. preg_match_all('/(\d+)/', $page, $wynik );

just change (\d+) <- this is for numbers

and then if $wynik[0][$n] ($n++) is equal to ebay

nico_swd
Dec 4th 2007, 11:31 am
No need for preg_match_all() and looping.

Here's an example:


$url = 'http://www.ebay.com';
$query = 'ebay';
$case_insensitive = true;


if ($source = @file_get_contents($url))
{
if (preg_match(sprintf('~%s~%s', preg_quote($query, '~'), $case_insensitive ? 'i' : ''), $source))
{
echo 'Found';
}
else
{
echo 'Not found';
}
}

Arson
Dec 4th 2007, 2:39 pm
Thanks :) :)