Advertisement
enissay

Enissay

Jun 3rd, 2014
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. $input =  <<<_DATA_
  2. <table id="tblAddProduct">
  3.     <tbody class='A2'>
  4.         <tr>
  5.             <td>Product Code :</td>
  6.             <td> tbody.1.TR.1.TD.2 <input/> </td>
  7.         </tr>
  8.         <tr>
  9.             <td>Product Description :</td>
  10.             <td> tbody.1.TR.2.TD.2 <input/> </td>
  11.         </tr>
  12.     </tbody>
  13.  
  14.     <tbody class='A2'>
  15.         <tr>
  16.             <td>Product Code :</td>
  17.             <td> tbody.2.TR.1.TD.2 <input/> </td>
  18.         </tr>
  19.         <tr>
  20.             <td>Product Description :</td>
  21.             <td> tbody.2.TR.2.TD.2 <input/> </td>
  22.         </tr>
  23.     </tbody>
  24. </table>
  25. _DATA_;
  26.  
  27. // Create a DOM object
  28. $html = new simple_html_dom();
  29. // Load HTML from a string
  30. $html->load($input);
  31.  
  32. // Loop through all the TR nodes
  33. foreach ( $html->find('#tblAddProduct tbody.A2 tr') as $tr ) {
  34.     echo $tr->find('td', 1)->plaintext;
  35.     echo '<br/>';
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement