Forum Moderators: coopster

Message Too Old, No Replies

php screen scrapping

fetching innerhtml w.r.t ID

         

kadnan

12:16 pm on Jan 20, 2007 (gmt 0)

10+ Year Member



I have the following HTML

<table id="est_hours" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr id="est_hours_1">
<td class="head" valign="top" width="45"> Mon:</td>
<td class="main" width="230"> 9:00am - 9:30pm </td>
</tr>
<tr id="est_hours_2">
<td class="head" valign="top" width="45"> Tue:</td>
<td class="main" width="230"> 9:00am - 9:30pm </td>
</tr>
<tr id="est_hours_3">
<td class="head" valign="top" width="45"> Wed:</td>
<td class="main" width="230"> 9:00am - 10:30pm </td>
</tr>
<tr id="est_hours_4">
<td class="head" valign="top" width="45"> Thu:</td>
<td class="main" width="230"> 9:00am - 10:30pm </td>
</tr>
<tr id="est_hours_5">
<td class="head" valign="top" width="45"> Fri:</td>
<td class="main" width="230"> 9:00am - 11:30pm </td>
</tr>
<tr style="background-color: rgb(250, 225, 158);" id="est_hours_6">
<td class="head" valign="top" width="45"> Sat:</td>
<td class="main" width="230"> 9:00am - 11:30pm </td>
</tr>
<tr id="est_hours_0">
<td class="head" valign="top" width="45"> Sun:</td>
<td class="main" width="230"> 9:00am - 9:30pm </td>
</tr>
</tbody>
</table>

and I have to retrieve info like

Mon:9:00am - 9:30pm
Tue:9:00am - 9:30pm
..
Thrus.....

Now things like Id and attrib like class are present. I am newbie in xml processing via php5. Is there anyway that i first get reference of id like "est_hours" and then loop thru with inner childs by referring their respective IDs or other attribs? Actually I am unable to find innerHTML equivalent in PHP5

Thanks

[edited by: jatar_k at 2:58 pm (utc) on Jan. 20, 2007]
[edit reason] removed url, added code [/edit]

eelixduppy

1:14 pm on Jan 20, 2007 (gmt 0)



innerHTML [w3schools.com] is a javascript property and does not exist for php. You can, however, use various regular expressions.

If the data is in xml format, and you have php 5, SimpleXML [us3.php.net] is very easy to use. The documentation has some examples for you to try out.