...

View Full Version : is there a way of finding if a html page has a certain format?



kevinkhan
11-01-2009, 09:01 PM
I want to do one thing if the html page contains


<span class="tel">Tel: 021 4929850 </span>

and another thing if the html page contains


<span class="tel">Tel: 021 4929850 </span>


<span class="tel2">Tel: 087 9870805</span>

Im using the file_get_contents(); funtion to get the html code..

GoodBanners.com
11-02-2009, 11:22 AM
Here's a start


preg_match_all('/<span class="(.*)">Tel: 087 9870805<\/span>/Uis', $html, $matches,PREG_SET_ORDER);
print_r($matches);

your matches are stored in $matches , just loop in $matches to find "tel2" and do your stuff, etc...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum