I am trying to extract this data (MARK PATER) from the webpage and I want it to be a String and NOT an hyperlink. Here is my code:
When I echo this is the result that I get on my browser: MARK PATERÂ Â . I am not able to extract this value as a string...It's a HYPERLINK. When I open up the source I get this:
<a class="filter_list" href="" onclick="return fillFilterForm(document.formFilter1, 'nation_party_name', 'MARK PATGHL');"><font face="Verdana" size="1" color="BLACK">MARK PATERÂ Â </font></a>string(0) ""
Here is part of the source code from echo $html:
<tr >
<td align="justify" width="5%" nowrap><font face="Verdana" size="1">
*
<a class="list_2" href="details.asp
?doc_id=2&index=0&file_num=07">View</a> </font>
</td>
<td width="20%" align="justify" ><a class="filter_list" href="" onClick="return fillFilterForm(document.formFilter1, 'party_name', 'NEW YORK GORDI’);”><font face="Verdana" size="1" color="BLACK">NEW YORK GORDI </font></td>
<td width="15%" align="justify" nowrap><a class="filter_list" href="" onClick="return fillFilterForm(document.formFilter1, ’Name’, ‘MARK PATER );”><font face="Verdana" size="1" color="BLACK">MARK PATER </font></td>
Code:
$html = file_get_html($link);
//echo htmlspecialchars ($html);
// a new dom object
$dom = new domDocument;
// load the html into the object
$dom->loadHTML($html);
$tables = $dom->getElementsByTagName('td');
echo get_inner_html($tables->item(26));
function get_inner_html( $node )
{
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child)
{
$innerHTML .= $child->ownerDocument->saveXML( $child );
}
return $innerHTML;
}
enter code here