getting what's between <td></td>

From: Date: Thu, 22 Feb 2001 05:32:04 +0000
Subject: getting what's between <td></td>
Groups: php.general 
Request: Send a blank email to php-general+get-41100@lists.php.net to get a copy of this message
Hello, I've been reading a LOT on how to solve my problem today, but haven't been able to come up with anything yet. Here's my problem: I have an html file that contains many table rows like this: <tr><td>Item1</td><td>Item1 Again</td></tr> <tr><td>Item2</td><td>Item2 Again</td></tr> <tr><td>Item3</tr><td>Item3 Again</td></tr> <tr><td>Item4</tr><td>Item4 Again</td></tr> And so on. I want to search this html for a table row that has 'Item3' in the first cell. And the second cell should contain 'Item3 Again'. I know that I can do this with something like this: $file = fopen("http://localhost/html.html", "r"); $data = fread($file, 10000); $results = eregi("<tr><td>Item3</tr><td>Item3 Again</td></tr>", $data); However, this won't exactly work for me, because that contents of the second cell will change daily, so tomorrow, the third table row could look like this: <tr><td>Item3</td><td>Item3 Has Changed</td></tr> I was thinking I could use sscanf() to do this, but couldn't get anything to work. I've tried everything I can think of. Sorry if the explanation of my problem was hard to understand, I don't exactly understand it myself. Thanks everybody!!! Regards, Tyler Longren

« previous php.general (#41100) next »