Buyrun hocam bu kodlar ile veriyi sorunsuz ve zahmetsiz bir şekilde alabilirsiniz.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body><?php
if(isset($_GET)) {
$burc = $_GET['id'];
$burclar = array(
'koc',
'boga',
'ikizler',
'yengec',
'aslan',
'basak',
'terazi',
'akrep',
'yay',
'oglak',
'kova',
'balik'
);
if(in_array($burc, $burclar)) {
$veri_url = 'http://www.hurriyet.com.tr/magazin/astroloji/burc.asp?bilgiType=gunluk&burc='.$burc;
$veri_al = html($veri_url, true, 'windows-1254', 'utf-8');
$preg_pattern_1 = '#<div\sclass="AstroDetailMainTitle">(.*?)<\/div>#si';
$preg_pattern_2 = '#<p\sclass="AstroDetailText">(.*?)<\/p>#si';
preg_match($preg_pattern_1, $veri_al, $eslesmeler_1);
preg_match($preg_pattern_2, $veri_al, $eslesmeler_2);
echo '<h1>'.trim(end($eslesmeler_1)).'</h1>';
echo '<p>'.trim(end($eslesmeler_2)).'</p>';
}
}
/* Yardımcı Fonksiyon(lar) */
function html($url, $iconv=false, $iconv_in_charset=null, $iconv_out_charset=null) {
return ($iconv) ? iconv($iconv_in_charset, $iconv_out_charset, @file_get_contents($url)) : @file_get_contents($url);
}
?></body>
</html>Ek olarak;
file_get_contents fonksiyonuyla hata alırsanız cURL ile çekim yapılmış halini özel ileti yoluyla yollayabilirim.