something goes wrong... sometimes the script shows less than its supposed to and sometimes it doesnt show very much
<?php
$open = fopen("http://www.comedycentral.com/mp/browseresults.jhtml?s=chappellesshow", "r");
// the above statement opens up the yahoo! page using the socket libraries and reads it,
// fopen takes the pages as the 1st arguement and type of opening (r in this case) as the 2nd
$read = fread($open, 1500000);
// fread scours to the 15000th byte and captures all the encountered bytes into $read
fclose($open);
// close the socket connection
$search = eregi("<br clear=all>(.*)<br>", $read, $printing);
// the magic line, eregi is a regex which does case insensitive search on a data, in this case
// is the $read variable. It searches for all data in between the 1st instance of "..."
// and the 1st instance of "</td></tr>..." I have generally seen that it should be valid html
// tags for it to result in a positive search, not logically correct though! If the search is
// true then store it in $printing
$printing[1] = str_replace("href=\"/homer/?", "href=\"", $printing[1]);
$printing[1] = str_replace("</td></tr><tr><td valign=top><b> ", "", $printing[1]);
$printing[1] = str_replace(" </b></td><td>", "", $printing[1]);
$printing[1] = str_replace("<small>", "", $printing[1]);
$printing[1] = str_replace("</small>", "", $printing[1]);
// the above code block is string manipulations, 1st replacing /homer/ then doing common
// denomination, i.e. in every news headline there is a common denominator the last 4 lines
// just do string manipulation on this basis, helping us to shift each headline into an array
// element, rather than just bringing in the yahoo! interface into it.
$content = $printing[1];
$content = explode("ยท", $content);
// well this is also a common cancellation or rather the place where the shifting headlines into
// elements actually takes place with the help of "?" and explode();
$headlines = sizeof($content);
// counting the array elements
for ($i = 0; $i < $headlines; $i++) {
print "<html><body> $content[$i]
";
}
// this is looping through each headline retrieved
?>
ok i got that script from the web and if you refresh it it will show you less or a little bit more but i never shows the whole page that its supposed to show.
its supposed to be showing //http://www.comedycentral.com/mp/browseresults.jhtml?s=chappellesshow but its not working go Here and then if you click refresh it will sometime show more or less... please help