<?php

function print_links ($url) 
{
   $fp = fopen($url, "r")
      or die("Nie mona odnale podanego adresu $url");
   $page_contents = "";
   while ($new_text = fread($fp, 100)) {
      $page_contents .= $new_text;
   }
   $match_result = 
      preg_match_all('/<\s*A\s*HREF="([^\"]+)"\s*>([^>]*)<\/A>/i',
                 $page_contents,
                 $match_array, 
                 PREG_SET_ORDER);
   foreach ($match_array as $entry) {
      $href = $entry[1];
      $anchortext = $entry[2];
      print("<B>CZE</B>: $href; 
             <B>TEKST CZA</B>:  $anchortext<BR>");
   }
}

?>
