Türkiye'nin En Eski Webmaster Forumu İyinet'e Hoşgeldiniz!

preg_match problemi

ecank

0
Onaylı Üye
Üye
Katılım
12 Temmuz 2010
Mesajlar
39
Açılan Konu
4
Tepki puanı
1
Şu kod ile adresi verilen siteden kod aralığındaki kısmı çekmek istiyorum. Yapamadım, sorun nerde acaba?

PHP:
 <?

$target_site = file_get_contents('http://www.frmtr.com/universiteler/3578879-g-antep-tip.html');

preg_match_all('/<!-- message -->(.*?)<!-- \/ message -->/', $target_site, $record);

for($i=0; $i<=count($record); $i++){
$sayi = '<font color=red>';
$sayi .= $i+1;
$sayi .= "</font>";
echo $sayi;
echo $record[0][$i];
}
?>
 

ecank

0
Onaylı Üye
Üye
Katılım
12 Temmuz 2010
Mesajlar
39
Açılan Konu
4
Tepki puanı
1
PHP:
 $target_site = file_get_contents('http://www.frmtr.com/universiteler/3578879-g-antep-tip.html'); 

preg_match_all('/<!-- message -->(.*?)<!-- \/ message -->/si', $target_site, $record); 


for ($i=0; $i<count($record[1]); $i++)
{
echo $record[1][$i]."<br>";
}

ile hallettim.
 
Üst