Futbolturkiye.net için haberleri takip etmekden yorulduğum bir gün e-kolaydan haber başlıklarını ve özetini aldığım ufak bir kod.

Xml sağolsun beni dertten kurtarmışdı.

PHP:
  1. $ch = curl_init(); //otrum aç
  2. $timeout = 5; //zaman aşımı
  3. curl_setopt ($ch, CURLOPT_URL, 'http://rss.ekolay.net/pages/spor.aspx'); // rss bağlantı adresi
  4. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  5. curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  6. $kaynak = curl_exec($ch);
  7. curl_close($ch);
  8.  
  9.     $Veri     = array();
  10.      $temp     = split("",$kaynak); // her bir itemin arasını al
  11.     for ($i=0;$i<=4;$i++){ //sadece 4 tane haberin gelmesini istiyorum 0        
  12.  
  13.  if(trim($temp[$i])==''){continue;}
  14.  
  15.     preg_match('/<title>(.*)<\/title>/i', $temp[$i], $title);
  16.         preg_match('/<description>(.*)<\/description>/i', $temp[$i], $desc);
  17.         preg_match('/
  18. <link>(.*)<\/link>/i', $temp[$i], $link);
  19.         array_push($Veri,array($title[1],$desc[1],$link[1]));
  20.     }
  21.         echo '
  22. <pre>';
  23.     for($x=0;$x<=4;$x++) {
  24.         echo "\n";
  25.         @print_r($Veri[$x][0]);
  26.         echo "\n";
  27.         @print_r($Veri[$x][1]);
  28.         echo "\n";
  29.         @print_r($Veri[$x][2]);
  30.         echo "\n".'
  31. ';
  32.     }
  33.         echo '</pre>
  34. ';
  35.  
  36.  
  37.  
  38. ?>

Yazıyı yayınlarken bir sorun yaşadım açıklamalar gitti, sadece kod var.

Sağol Curl kütüphanesi, Var ol Xml.