<?
$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];
}
?> preg_match problemi
3
●304
- 05-08-2010, 23:47:40Şu kod ile adresi verilen siteden kod aralığındaki kısmı çekmek istiyorum. Yapamadım, sorun nerde acaba?
- 06-08-2010, 00:14:23Sayfanda karakter seti belirtiyorsan 3. satırdaki header fonksiyonunu sil.
<? header('content-type: text/html; charset=iso-8859-9'); $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); $i++){ $sayi = '<font color=red>'; $sayi .= $i+1; $sayi .= "</font>"; echo $sayi; echo $record[0][$i]; } ?>Ayrıca XHTML'ye uygun değil bu. color=red gibi tırnaksız kullanman zaten yanlış, ve onun yerine <span style="font-color: red;"></span> kullanman daha iyi. - 06-08-2010, 01:35:03
$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. teşekkürler yardımlar için.