Wednesday, 15 July 2015

table - Reading Another Website in PHP -



table - Reading Another Website in PHP -

i have php script creates calendar , highlights current day , everything. want open website , read table 1 below, , getting "info" "date" , set on calendar.

<table> <tr> <th>date</th> <th>info</th> </tr> <tr> <td>2/20/2013</td> <td>meeting</td> </tr> <tr> <td>2/24/2013</td> <td>another meeting</td> </tr> </table>

with code:

$url = $pageurl; $content = file_get_contents($url); $needle = $month . '/' . $list_day . '/' . $year; if (strpos($content, $needle)) { $calendar .= '<p>stuff</p><p>more stuff</p>'; }

i have been somwhat successful, can output "stuff" , "more stuff" onto day appears on calendar. want post stuff day. how can this? help appreciated.

i answered similar question here. can re-create getcellvalue() function there, , utilize like:

$dom = new domdocument(); $dom->preservewhitespace = false; $dom->loadhtml('...table html here...'); $table = $dom->getelementsbytagname('table')->item(0); print getcellvalue($table, 'info', array( 'date' => '2/20/2013', ));

this should print corresponding "info" value requested date ("meeting")

php table website

No comments:

Post a Comment