Reply to can I use fopen to get only what the browser would display ?

Your name:

Reply:


Posted by charliefortune on 01/10/06 19:30

I want to read lots of pages looking for the expression 'sold out'. I
am currently using fgets() but unfortunately this picks up comments and
javascript which may include the expression.

How can I get just what the viewer would see in their browser ?

//check line by line
while (! feof($fp)){
$buffer = fgets($fp,4069);

//see if the price we have is somewhere on the page
if (strstr($buffer,$a_row['price'])){
$found['price']=1;
}

//look for the words 'out of stock'
$string = "out of stock";
if (strstr($buffer,$string)){
$found['stock'] = 0;
}
elseif (strstr($buffer,"SOLD OUT")){
$found['stock'] = 0;
}
}

//after reading page....
if ($found['price'] == 0){
print "This stock item : <a href=\"".$a_row['bare_url']."\"
target=\"_blank\">".$a_row['id_stock']."</a> has price problems<br>";
}


if ($found['stock'] == 0){
print "This stock item : <a href=\"".$a_row['bare_url']."\"
target=\"_blank\">".$a_row['id_stock']."</a> appears to be out of
stock<br>";
$query = "UPDATE stock SET id_flag = 1 WHERE id_stock =
".$a_row['id_stock'].";";
mysql_query($query);
}

fclose($fp);
}

thanks

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация