I'm new to PHP, so please bear with me if there is a simple explanation for this.
Baisically, I'm trying to search a fantasy baseball html page for a number that is updated daily. This number is ALWAYS associated with some particular text. For example: SWP: 55555.
I have been successful in changing a variable from 0 to 1 if the text and number were found on the page, but this only works when the number is "hard coded". How can I get a script to check for an increasing number starting from 0. In other words, how can I get the script to check for SWP: 1, then SWP: 2, then SWP: 3, etc. until it finds the one that exists?
This is the code I'm using with VERY limited success:
<?
$i = 0;
$found = 0;
$url = "http://baseball.smallworld.com/midseason/main/manager_other.html?user_id=91857";
$the_page = fopen($url, "r");
Function Search ()
{global $the_page, $url, $search_criteria, $found;
while(!feof($the_page))
{
$each_line = fgetss($the_page, 255);
if(eregi($search_criteria, $each_line, $results))
{$found = 1;}
}}
while($found == 0)
{
$i++;
$search_criteria = "SWP: $i";
Search ();
}
print("$search_criteria");
?>
Thanks in advance for any help.