R10 Php Kütüphanesi
94
●41.648
- 02-01-2013, 14:19:18Az önce bir başlıkta puandurumu için bir istek olmuştu bu da beni ilk botumu yazmaya teşvik etti. Buyrun sizde kullanın. Puan durumu bilgilerini haberturk ten çekmektedir.
<?php /** * Süper Lig Puan Durumu * @author Gökhan YILDIZ - http://www.gokhan-yildiz.com */ function get($first, $last, $text) { @preg_match_all('/' . preg_quote($first, '/') . '(.*?)'. preg_quote($last, '/').'/i', $text, $m); return @$m[1]; } // Get Content $url = "http://spor.haberturk.com/iddaa/puandurumu/1/turkiye-spor-toto-super-lig"; $content = file_get_contents($url); $get_s = get('class="col1">', '</td>', $content); $get_t = get('class="col2">', '</td>', $content); $get_o = get('class="col3">', '</td>', $content); $get_g = get('class="col4">', '</td>', $content); $get_b = get('class="col5">', '</td>', $content); $get_m = get('class="col6">', '</td>', $content); $get_a = get('class="col7">', '</td>', $content); $get_y = get('class="col8">', '</td>', $content); $get_p = get('class="col9">', '</td>', $content); $get_av = get('class="col10">', '</td>', $content); $get_c = (count($get_s) - 1)/3; //Superlig Puan Durumu echo' <table width="400px" border="1" cellpadding="0" cellspacing="0" style="border:1px dotted #ccc;"> <tr style="background-color:#000; color:#fff; font-weight:bold;"> <td style="width:20px;">Sıra</td> <td style="width:220px;">Takım Adı</td> <td style="width:20px;">O</td> <td style="width:20px;">G</td> <td style="width:20px;">B</td> <td style="width:20px;">M</td> <td style="width:20px;">A</td> <td style="width:20px;">Y</td> <td style="width:20px;">P</td> <td style="width:20px;">AV</td> </tr> '; for ($i=0; $i<=$get_c; $i++) { echo ' <tr> <td><b>'.$get_s[$i].'</b></td> <td>'.strip_tags($get_t[$i]).'</td> <td>'.$get_o[$i].'</td> <td>'.$get_g[$i].'</td> <td>'.$get_b[$i].'</td> <td>'.$get_m[$i].'</td> <td>'.$get_a[$i].'</td> <td>'.$get_y[$i].'</td> <td>'.$get_p[$i].'</td> <td>'.$get_av[$i].'</td> </tr> '; } echo '</table>'; ?>İlgili Konu: https://www.r10.net/php/955535-puan-durumu.html
Çalışan Örneği: http://gokhan-yildiz.com/puandurumu.php - 02-01-2013, 16:50:59Bir üstteki mesajımda puandurumunu vermiştim. Bu da fikstür için. Verileri skorist ten çekmektedir. Bu hafta, geçen hafta ve gelecek haftanın sonuçlarını gösterir.
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <?php /** * Süper Lig Fikstür * @author Gökhan YILDIZ - http://www.gokhan-yildiz.com */ function get($first, $last, $text) { @preg_match_all('/' . preg_quote($first, '/') . '(.*?)'. preg_quote($last, '/').'/i', $text, $m); return @$m[1]; } $status =strip_tags(htmlspecialchars(trim($_GET["week"]))); // Get Content if($status=="this"){ $url = "http://skorer.milliyet.com.tr/Fikstur?TTName=";} elseif($status=="next") { $url = "http://skorer.milliyet.com.tr/Fikstur?TTName=&RW=1";} elseif($status=="last") { $url = "http://skorer.milliyet.com.tr/Fikstur?TTName=&RW=-1";} elseif($status==""){ $url = "http://skorer.milliyet.com.tr/Fikstur?TTName="; } $content = file_get_contents($url); $get_date = get('class="date">', '</td>', $content); $get_hour = get('class="hour">', '</td>', $content); $get_team1 = get('class="team team1">', '</td>', $content); $get_score = get('class="sonuc">', '</td>', $content); $get_team2 = get('class="team team2">', '</td>', $content); $get_count = count($get_date) - 1; //Superlig Puan Durumu echo ' <a href="fixture.php?week=last">Geçen Hafta</a> | <a href="fixture.php?week=this">Bu Hafta</a> | <a href="fixture.php?week=next">Gelecek Hafta</a> '; if($status=="this"){echo "<h4>Süper Lig'de Bu Hafta</h4>";} elseif($status=="next"){echo "<h4>Süper Lig'de Gelecek Hafta</h4>";} elseif($status=="last"){echo "<h4>Süper Lig'de Geçen Hafta</h4>";} elseif($status==""){echo "<h4>Süper Lig'de Bu Hafta</h4>";} echo' <table width="560px" border="1" cellpadding="0" cellspacing="0" style="border:1px dotted #ccc;"> <tr style="background-color:#000; color:#fff; font-weight:bold;"> <td style="width:120px;">Tarih</td> <td style="width:50px;">Saat</td> <td style="width:220px;">Ev Sahibi</td> <td style="width:50px;">Skor</td> <td style="width:220px;">Misafir Takım</td> </tr> '; for ($i=0; $i<=$get_count; $i++) { echo ' <tr> <td>'.$get_date[$i].'</td> <td>'.$get_hour[$i].'</td> <td>'.$get_team1[$i].'</td> <td>'.strip_tags($get_score[$i]).'</td> <td>'.$get_team2[$i].'</td> </tr> '; } echo '</table>'; ?>Demo: http://gokhan-yildiz.com/fixture.php - 22-01-2013, 15:08:42Kimlik doğrulama veya yönetimden onay bekliyor.çok yararlı kodlar. emeği geçenlere teşekkürler.
- 08-05-2013, 23:16:11Kimlik doğrulama veya yönetimden onay bekliyor.Embed kodlarını otomatik boyutlandırdığım fonksiyonum
function Embed_Duzenle($data,$genislik,$yukseklik){ $deger = "/width=\"[0-9]*\"/"; $data = preg_replace($deger, "width='{$genislik}'", $data); $deger = "/height=\"[0-9]*\"/"; $data = preg_replace($deger, "height='{$yukseklik}'", $data); return $data; }kullanımı
Embed_Duzenle($embed,500,300);
Utf-8 formatındaki metinleri kısaltmada kullandığım fonksiyonum
function kisalt($data,$x){ $data = strip_tags($data); return mb_substr($data,0,$x,"UTF-8"); }kullanımı
kisalt($veri,100);
Sql injectiondan korunma Post ve Get filtreleme
## get - post filtrele function suzgec($data){ $data = strip_tags($data); $data = addslashes($data); return $data; } ## get function q($data){ return suzgec($_GET[$data]); } ## post function p($data){ return suzgec($_POST[$data]); } - 30-06-2013, 20:37:50Kimlik doğrulama veya yönetimden onay bekliyor.
function base($path='') { $run_script = dirname($_SERVER['SCRIPT_NAME']); $http_url = rtrim('http'.':'.'//'.$_SERVER['HTTP_HOST'].str_replace('\\', '/', $run_script), '/').'/'; if(!empty($path)) $http_url .= $path; return $http_url; }Kullanımı;
echo base(); // eğer localhost'da çalışıyorsak çıktımız şu olacaktır. -> http://localhost/ echo base('css/style.css'); // çıktısı -> http://localhost/css/style.css----------------------------------
function prepare_http_get_query() { $route = (empty($_GET['route'])) ? 'index.php' : $_GET['route']; unset($_GET['route']); $http_get_array_keys = array_keys($_GET); $http_get_array_values = array_values($_GET); foreach($http_get_array_keys as $key) unset($_GET[$key]); $route_array = explode('/', $route); $route_pagename = $route_array[0]; $route_queries = array_values($route_array); $_GET['route_pagename'] = $route_pagename; $_GET['route_queries'] = $route_queries; $last_route_queries = end($route_queries); if(count($route_queries) > 0) array_pop($route_queries); $last_route_queries_array = explode('.', $last_route_queries); $last_route_query_extension = end($last_route_queries_array); if(count($last_route_queries_array) > 1) array_pop($last_route_queries_array); $last_route_queries = array('filename' => end($last_route_queries_array), 'extension' => $last_route_query_extension); $_GET['route_queries'][] = $last_route_queries; foreach($http_get_array_keys as $key => $value) $_GET['request_queries'][$value] = $http_get_array_values[$key]; }Kullanımı;
# kilit dosyalarımızdan herhangi birinde bu fonksiyonu çalıştırmamız gerekiyor. prepare_http_get_query(); # Daha sonra $_GET globalindeki değişkenleri daha düzgün bi' şekilde görebiliyoruz. print_r($_GET); # çıktısı /* Array ( [route_pagename] => index.php [route_queries] => Array ( [0] => index.php [1] => Array ( [filename] => index [extension] => php ) ) ) */ # herhangi bi' GET sorgusu yaparsak çıktımız böyle oluyor /* Array ( [route_pagename] => index.php [route_queries] => Array ( [0] => index.php [1] => Array ( [filename] => index [extension] => php ) ) [request_queries] => Array ( [get1] => 123 [get2] => 123 ) ) */ - 30-10-2013, 21:24:28Kimlik doğrulama veya yönetimden onay bekliyor.İsime yarayacak, tesekkurler.

GT-S5830i cihazımdan Tapatalk 2 ile gönderildi
