When preparing to do the following I found a lot of info that was not clear so I thought id ask this to see if someone could clear somethings up for me.
what exactly is the @ symbol doing to the following
$domOb = new DOMDocument();
$html = @$domOb->loadHTMLFile('http:...');
This did remove an error and actually parse the data but is this a good practice solution. I have used this without the @ symbol and got expected results.
Given that I have several tables what is the best/simplist way to get all the <td>
from lets say table 3. I was going to list all the <td>
and then simply start and end with the value that correlates with the needed data
If looking to parse HTML via PHP I like the Idea of using DOM so when getting the file what should I use. loadHTMLFile()
loadHTML()
... can I still use Xpath?...If its very busy/badly marked up HTML does this matter?
Whats good practice for looking through the data
$items = $domOb->getElementsByTagName('td');
$k = 0;
$num = $items->length;
while ($k < $num)
{
echo $item_web = $items->item($k)->, '<br>';
$k++;
}
I found this which is good How do you parse and process HTML/XML in PHP? but its 2 years old so I thought id pose a few questions.
Just a small clip of the 3rd table... At first glance I noticed a space at the 3rd tag does this affect the results?
<td>Parcel ID: <a href=... style=text-decoration:underline;><b>666666</b></a></td>
<td>Name: Mr. help</td></tr><tr>
<td >Parcel Address: 666 help RD </td>
<td>Name2: Ms. help F</td></tr><tr><td>City: Helpover 66666</td>
<td>Address: 6666 6TH AVE NE UNIT 333</td>