Hi,
I'm looking for a method to get some information from another website (http://contests.covers.com/sportscontests/picksByDate.aspx?date=11/2/2007&ur=265839&contestID=15253&sportID=9) in an automated way. I need to get the total value of a NBA game between boston and another team (variable team) and if Boston got WIN or LOSS in its row.
I've tried this but I have a little problem:
<?php
$url = 'http://contests.covers.com/sportscontests/picksByDate.aspx?date=11/2/2007&ur=265839&contestID=15253&sportID=9&t=0';
$array = file($url);
$key = array_search('<table cellspacing="0" class="thepicks">
', $array);
$flop = $key + 12;
$result = $array[$flop];
print($result);
?>
This is a test script and it works. The way I want to retrieve my information is by searching the Boston team in the array (note that it is a link). The problem i'm facing is that I doesn't find: <td><a href="http://www.covers.com/pageLoader/pageLoader.aspx?page=/data/nba/teams/team404117.html">New Jersey</a></td>
in my array. So the following code doesn't give me the right line. It takes array[0] +15 which is wrong.
<?php
$url = 'http://contests.covers.com/sportscontests/picksByDate.aspx?date=11/2/2007&ur=265839&contestID=15253&sportID=9&t=0';
$array = file($url);
$key = array_search('<td><a href="http://www.covers.com/pageLoader/pageLoader.aspx?page=/data/nba/teams/team404117.html">New Jersey</a></td>
', $array);
$flop = $key + 15;
$result = $array[$flop];
print($result);
?>
The variable in the array (<td><a href="http://www.covers.com/pageLoader/pageLoader.aspx?page=/data/nba/teams/team404117.html">New Jersey</a></td>) can be shown using the first code fragment. So it is surely displayable.
So does anyone know why he can't find this link (<td><a href="http://www.covers.com/pageLoader/pageLoader.aspx?page=/data/nba/teams/team404117.html">New Jersey</a></td>) in my array?
Thanks is higly appreciated!