PHP get cell content -
i want retrieve php contents of table cell file. code, retrieve contents of all cells of row.
$url = 'folder/mypage.php'; $content = file_get_contents($url); $first_step = explode('<tr id="foo">' , $content ); $second_step = explode('</tr>' , $first_step[1] ); echo $second_step[0];
how retrieve particular cell ? (the second, example...)
$url = 'folder/mypage.php'; $content = file_get_contents($url); //ugly code !...doesn't work ! $first_step = explode('<tr id="foo"><td[1]' , $content ); $second_step = explode('</td></tr>' , $first_step[1] ); echo $second_step[0];
thanks.nicolas.
i have found solution !! second explode </td>
, not </tr>
:
$url = 'folder/mypage.php'; $content = file_get_contents($url); $first_step = explode('<tr id="' . $ref . '">' , $content ); $second_step = explode('</td>' , $first_step[1] ); echo $second_step[1]; // show content of second cell echo $second_step[5]; // show content of sixth cell // etc... // "$ref" loop foreach in list of elements
i did not want use library doing (like simple_html_dom : 1800 lines of code , watch file !! heavy.)
with solution, it's working charm ! i'm happy..:-) [solved]. nicolas
Comments
Post a Comment