or need to extract all h1 tags and insert into database
You can modify this code to make it work?
//////////////////////////////////////////////////////////////////
function getTextBetweenTags($tag, $get, $strict=0)
{
/ a new dom object /
$dom = new domDocument;
/*** load the html into the object ***/
if($strict==1)
{
$dom->loadXML($get);
}
else
{
$dom->loadHTML($get);
}
/*** discard white space ***/
$dom->preserveWhiteSpace = false;
/*** the tag by its tag name ***/
$content = $dom->getElementsByTagname($tag);
/*** the array to return ***/
$out = array();
foreach ($content as $item)
{
/*** add node value to the out array ***/
$out[] = $item->nodeValue;
}
/*** return the results ***/
return $out;
}
$content = getTextBetweenTags('h1', $get);
foreach( $content as $item )
{
$h1 = $item.'<br />';
}
$query="UPDATE sitis SET
hh = '$h1' WHERE id = '$a'"; //My only problem and that puts an h1