0

Hi I have used Curl to obtain a webpage (stored in a variable called $result). Within this webpage I just want to obtain specific content that is within a certain DIV tag. Here is the part of the page that contains the DIV tag that I am interested in:

    <div id="bookInfo">
<table>
<tr>
<td><b>Title:</b>  </td>
<td>OLIVER TWIST</td>
</tr>
<tr>
<td><b>Author:</b>  </td>
<td>CHARLES DICKENS</td>
</tr>
<tr>
<td><b>Publisher:<b/>  </td>
<td>PUFFIN</td>
</tr>
<tr>
<td><b>Published Date:</b></td>
<td>27-MAR-2002</td>
</tr>
<tr>
<td><b>PRICE:</b>  </td>
<td>8.99</td>
</tr>
</table>
</div>

What I want to do is store the title, author, date etc into a variable. For example I want a $title variable that holds 'OLIVER TWIST', an $author variable that holds 'CHARLES DICKENS' and so on. Also for the date published, I just want the last 4 digits, i.e the year.

I have been looking into things like PHP DOM but I dont know how I can first obtain just this DIV tag and then just the specific content within it. Hope someone can help. Thanks

3
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by diafol
0

Ive been looking at DOM all day but I dont know where to start in terms of my example. Any pointers or examples would be appreciated. Thanks

0

This has been covered to death in the php forum. Have a search here. I think about 3 or 4 members have started a similar thread just this month.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.