reading the html
Posted: Tue Aug 08, 2006 6:15 am
Pimptastic | Please use
thanks for your help, and please no un-inspirational comments on my lack of proper php code.
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi all...i am trying to have php read html files. i have a bunch that all have the same format (essentially) and i would like to extract the text between tags: ie- [b]<br><b> [/b]sample text [b]<b>[/b] // output would be [i]sample text[/i]
i confess i am getting very lost here, and i sincerely hope i am heading the right direction with this. I am piecing this together, via the php manual...so you can see how unexperienced i am with php!Code: Select all
<?php
$menuType=$_GET['gallery'];
$directory="images/$menuType/".$menuType.".html";
$fileName="images/".$menuType."/".$menuType.".html";
$handle=fopen($fileName,"r");
$contents=fread($handle,filesize($fileName));
$words=".+";//this is where i am getting lost
$wanted=preg_match_all('/\<br\>\<b\>$words/i', $contents, $matches);//this is where i am completely lost
foreach ($matches as $val) {
echo $val;//states Array, so i must be close???
}
fclose($handle);
?>Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]