function parseHtml( $s_str )
{
$i_indicatorL = 0;
$i_indicatorR = 0;
$s_tagOption = "";
$i_arrayCounter = 0;
$a_html = array();
// Search for a tag in string
while( is_int(($i_indicatorL=strpos($s_str,"<",$i_indicatorR))) ) {
// Get everything into tag...
$i_indicatorL++;
$i_indicatorR = strpos($s_str,">", $i_indicatorL);
$s_temp = substr($s_str, $i_indicatorL, ($i_indicatorR-$i_indicatorL) );
$a_tag = explode( ' ', $s_temp );
// Here we get the tag's name
list( ,$s_tagName,, ) = each($a_tag);
$s_tagName = strtoupper($s_tagName);
// Well, I am not interesting in
, or anything else like that...
// So, this is false for tags without options.
$b_boolOptions = is_array(($s_tagOption=each($a_tag))) && $s_tagOption[1];
if( $b_boolOptions ) {
// Without this, we will mess up the array
$i_arrayCounter = (int)count($a_html["$s_tagName"]);
// get the tag options, like src="htt://". Here, s_tagTokOption is 'src'and s_tagTokValue is '"http://"'
do {
$stag = explode("=", "$s_tagOption[1]", 2);
$s_tagTokOption = $stag[0];
$s_tagTokValue = $stag[1];
$a_html[$s_tagName][$i_arrayCounter][$s_tagTokOption] = $s_tagTokValue;
$b_boolOptions = is_array(($s_tagOption=each($a_tag))) && $s_tagOption[1];
}
while( $b_boolOptions );
}
}
return $a_html;
}
Just trying to get this to parse correctly without these errors:
Notice: Undefined index: META in /var/www/bob/verify.php on line 23
Notice: Undefined index: STYLE in /var/www/bob/verify.php on line 23
Notice: Undefined index: !-- BODY in /var/www/bob/verify.php on line 23
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined index: TABLE in /var/www/bob/verify.php on line 23
Notice: Undefined index: TD in /var/www/bob/verify.php on line 23
Notice: Undefined index: DIV in /var/www/bob/verify.php on line 23
Notice: Undefined index: A in /var/www/bob/verify.php on line 23
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined index: IMG in /var/www/bob/verify.php on line 23
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28
Notice: Undefined offset: 1 in /var/www/bob/verify.php on line 28