Lingerie - Sportingbet - Ford Cars in Milton Keynes - Find jobs - Wordpress Themes

PDA

View Full Version : Strip particular html tag


Smaug
Aug 21st 2007, 1:45 pm
Hi, I have this problem, I have bunch of html files and I need to extract contents of <embed> tag in each file... I can do the file opening etc alone but I dont know about the tag thing, can you suggest me some php function or method?
Thank you

tubiron
Aug 21st 2007, 3:30 pm
You could try something like this:

$begin = strPos($htmlContent, '<embed>');
$end = strPos($htmlContent, '</embed>');
$extracted = substr($htmlContent,$begin,($end - $begin));

Smaug
Aug 21st 2007, 3:46 pm
Yes! It works, thank you.

alexts
Aug 21st 2007, 4:07 pm
Hi, I have this problem, I have bunch of html files and I need to extract contents of <embed> tag in each file... I can do the file opening etc alone but I dont know about the tag thing, can you suggest me some php function or method?
Thank you

preg_match_all('|<embed[^>]*?>(.*?)</embed>|si',$html,$matches);

deriklogov
Aug 28th 2007, 8:37 pm
Is there any software for windows which would do the same and save that extraction to file ? ( plus crawling one site)