Burada tam olarak nerde hata yapıyorum ?
6
●384
- 20-11-2013, 19:23:10komple boş sayfa çıkıyor.YuqseLX adlı üyeden alıntı: mesajı görüntüle
<?php if (function_exists('adanademir')){ adanademir(); } ?>
fonksiyonu ile çekmeye çalışıyorum yine boş sayfa.. - 20-11-2013, 19:48:29sonuç yine değişmedi hocamYuqseLX adlı üyeden alıntı: mesajı görüntüle
- 20-11-2013, 20:18:33Kimlik doğrulama veya yönetimden onay bekliyor.@boystar;
<?php header("Content-Type: text/html; charset=UTF-8"); function adanademir() { $URL = "http://www.canliskor.com.tr/futbol/takim/adana-demirspor/6"; $response = file_get_contents($URL); if(strlen($response) > 0) { $next_five_match = preg_match_all("#\<div\sclass\=\"wrapper\swell\swell\-none\sspan6\"\>(.*?)\<tbody\>(.*?)\<\/tbody\>#si", $response, $matches) ? $matches[0][1] : null; unset($response); if(!is_null($next_five_match)) { $response = (object) array( "data" => array() ); $response->data["title"] = preg_match("#\<h2\sclass\=\"pull\-left\"\>(.*?)\<\/h2\>#si", $next_five_match, $matches) ? trim(end($matches)) : null; $response->data["next_matches"] = array(); $tbody = preg_match("#\<tbody\>(.*?)\<\/tbody\>#si", $next_five_match, $matches) ? end($matches) : null; if(!is_null($tbody)) { $tr = preg_match_all("#\<tr\>(.*?)\<\/tr\>#si", $tbody, $matches) ? $matches[1] : null; unset($tbody); foreach($tr as $td) { $td = preg_match_all("#\<td(.*?)\>(.*?)\<\/td\>#si", $td, $matches) ? array_map("trim", array_map("strip_tags", $matches[2])) : null; $response->data["next_matches"][] = (object) array( "date" => html_entity_decode($td[0]), "league" => html_entity_decode($td[1]), "home_team" => html_entity_decode($td[2]), "away_team" => html_entity_decode($td[4]) ); } } $response->data = (object) $response->data; return $response; } else return null; } else return null; } print_r(adanademir()); /* <= OUTPUT => stdClass Object ( [data] => stdClass Object ( [title] => GELECEK 5 MAÇ [next_matches] => Array ( [0] => stdClass Object ( [date] => 23 Kas 19:00 [league] => PTT1L [home_team] => Adana Demir. [away_team] => Kahramanma. ) [1] => stdClass Object ( [date] => 30 Kas 14:00 [league] => PTT1L [home_team] => İstanbul BŞB [away_team] => Adana Demi. ) [2] => stdClass Object ( [date] => 04 Ara 21:00 [league] => TÜK [home_team] => Adana Demir. [away_team] => Bursaspor ) [3] => stdClass Object ( [date] => 08 Ara 19:00 [league] => PTT1L [home_team] => Adana Demir. [away_team] => Tavşanlı L. ) [4] => stdClass Object ( [date] => 15 Ara 00:00 [league] => PTT1L [home_team] => Fethiyespor [away_team] => Adana Demi. ) ) ) ) */