Nu har jeg fået mixet dette sammen:
Men den henter bare hele møget og sotere intet fra..?
<?php
$open = fopen("
http://130.228.82.161/grapit.php", "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, 15000);
// fread scours to the 15000th byte and captures all the encountered bytes into $read
fclose($open);
// close the socket connection
$search = eregi("<b></b>", $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("<b>", "", $printing[1]);
$printing[1] = str_replace("</b>", "", $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 "$read
";
}
// this is looping through each headline retrieved
?>