Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $input = <<<_DATA_
- <table id="tblAddProduct">
- <tbody class='A2'>
- <tr>
- <td>Product Code :</td>
- <td> tbody.1.TR.1.TD.2 <input/> </td>
- </tr>
- <tr>
- <td>Product Description :</td>
- <td> tbody.1.TR.2.TD.2 <input/> </td>
- </tr>
- </tbody>
- <tbody class='A2'>
- <tr>
- <td>Product Code :</td>
- <td> tbody.2.TR.1.TD.2 <input/> </td>
- </tr>
- <tr>
- <td>Product Description :</td>
- <td> tbody.2.TR.2.TD.2 <input/> </td>
- </tr>
- </tbody>
- </table>
- _DATA_;
- // Create a DOM object
- $html = new simple_html_dom();
- // Load HTML from a string
- $html->load($input);
- // Loop through all the TR nodes
- foreach ( $html->find('#tblAddProduct tbody.A2 tr') as $tr ) {
- echo $tr->find('td', 1)->plaintext;
- echo '<br/>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement