kardeş çok teşekkür ederim çok kolay oldu bu iş

script deki en basit kısım oldu.

)
hazırladığım kodları paylaşayım bari belki işine yarayan olur:
$tarih = date("Y-m-d"); function curl($url) { $user_agent = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt ($ch, CURLOPT_REFERER, $url); $icerik = curl_exec($ch); curl_close($ch); return $icerik; } $html = curl('http://www.mersineczaciodasi.org.tr/Nobet/NobetListesi?NobetTarih='.$tarih.'&get_param='); $adi = '@"eczane_adi": "(.*?)"@si'; $ilce = '@"ilce": "(.*?)"@si'; $adres = '@"adres": "(.*?)"@si'; $telefon = '@"telefon1": "(.*?)"@si'; $saat1 = '@"nobet_baslangic_tarihsaat": "(.*?)"@si'; $saat2 = '@"nobet_bitis_tarihsaat": "(.*?)"@si'; preg_match_all($adi, $html, $adi); preg_match_all($ilce, $html, $ilce); preg_match_all($adres, $html, $adres); preg_match_all($telefon, $html, $telefon); preg_match_all($saat1, $html, $saat1); preg_match_all($saat2, $html, $saat2); $say = count($adi[1]); $i=0; while ($i < $say) { echo $adi[1][$i]." ".$i."<br>"; $i++; }
ne demek hocam
çok daha basit bir yolunu da paylaşmak isterim;
$html = curl('http://www.mersineczaciodasi.org.tr/Nobet/NobetListesi?NobetTarih='.$tarih.'&get_param=');
$json = json_decode($html, true);
foreach($json as $index => $data) {
echo $data['eczane_adi'].'. '.($index+1).'<br />';
}$data['telefon1'] telefon numarası,
$data['telefon2'] 2. telefon numarası,
$data['adres'] adres gibi, gelen JSON'daki değişken adlarına göre veri alabilirsiniz.