comez.dev
tr
~/software/super-lig-api-puan-durumu-superlig-fixtur-apiTüm projeler

yazılım

Süper Lig API - Puan durumu - Superlig Fixtur Api

Merhabalar, Geçenlerde bir haber sitesinde kullanma için TFF'nin kendi sitesinden bizzat veri okuyan bir küçük betik yapmıştım süperlig puan durumu, fixtür vb işlemleri sağlıyor. Kullanımı son derece basittir github'ta bizzat anlattım zaten ama burada da paylaşayım;

eklenme
8 Eki 2026
Ayrıntılar

Merhabalar, Geçenlerde bir haber sitesinde kullanma için TFF'nin kendi sitesinden bizzat veri okuyan bir küçük betik yapmıştım süperlig puan durumu, fixtür vb işlemleri sağlıyor.

Kullanımı son derece basittir github'ta bizzat anlattım zaten ama burada da paylaşayım;

TFF Süper Lig Veri API

Türkiye Futbol Federasyonu'nun Süper Lig verilerini JSON API olarak sunan sistem.

Kurulum

  1. Dosyaları sunucuya yükleyin
  2. scrape_tff.php çalıştırın
  3. results.php ile web arayüzünü görün

API Kullanımı

Veri Dosyası Dahil Etme

<?php
// Ana veri dosyasını dahil et
include 'tff_superlig_data.php';

// Veri yapısı
$data = $tff_superlig_data;

// Kullanılabilir veriler:
// - $data['fixtures']     // Tüm maçlar
// - $data['standings']    // Puan cetveli
// - $data['clubs']        // Kulüp bilgileri
// - $data['top_scorers']  // Gol krallığı
// - $data['meta']         // Meta bilgiler
?>

Fikstür Verilerini Kullanma

<?php
include 'tff_superlig_data.php';

// Tüm fikstürleri al
$fixtures = $tff_superlig_data['fixtures'];

// Belirli haftanın maçları
$week18Fixtures = array_filter($fixtures, function($match) {
    return $match['week'] === 18;
});

// Tamamlanmış maçlar
$completedMatches = array_filter($fixtures, function($match) {
    return $match['status'] === 'completed';
});

// Yaklaşan maçlar
$upcomingMatches = array_filter($fixtures, function($match) {
    return $match['status'] === 'scheduled';
});

echo "Toplam maç: " . count($fixtures) . "\n";
echo "Tamamlanmış: " . count($completedMatches) . "\n";
echo "Yaklaşan: " . count($upcomingMatches) . "\n";
?>

Puan Cetveli

<?php
include 'tff_superlig_data.php';

$standings = $tff_superlig_data['standings'];

echo "<table border='1'>";
echo "<tr><th>Sıra</th><th>Takım</th><th>O</th><th>G</th><th>B</th><th>M</th><th>P</th></tr>";

foreach ($standings as $team) {
    echo "<tr>";
    echo "<td>" . $team['position'] . "</td>";
    echo "<td>" . $team['team'] . "</td>";
    echo "<td>" . $team['played'] . "</td>";
    echo "<td>" . $team['won'] . "</td>";
    echo "<td>" . $team['drawn'] . "</td>";
    echo "<td>" . $team['lost'] . "</td>";
    echo "<td>" . $team['points'] . "</td>";
    echo "</tr>";
}

echo "</table>";
?>

Gol Krallığı

<?php
include 'tff_superlig_data.php';

$topScorers = $tff_superlig_data['top_scorers'];

echo "<h2>Gol Krallığı</h2>";
echo "<ol>";

foreach ($topScorers as $scorer) {
    if ($scorer['goals'] > 0) {
        echo "<li>" . $scorer['name'] . " (" . $scorer['team'] . ") - " . $scorer['goals'] . " gol</li>";
    }
}

echo "</ol>";
?>

JSON API Olarak Kullanım

<?php
header('Content-Type: application/json');
include 'tff_superlig_data.php';

// Tüm veriyi JSON olarak döndür
echo json_encode($tff_superlig_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
?>

JavaScript ile AJAX Kullanımı

// Tüm verileri çek
fetch('api.php')
    .then(response => response.json())
    .then(data => {
        console.log('Fikstür sayısı:', data.fixtures.length);
        console.log('Takım sayısı:', data.standings.length);
    });

// Sadece puan cetveli
fetch('api.php?type=standings')
    .then(response => response.json())
    .then(standings => {
        standings.forEach(team => {
            console.log(team.position + '. ' + team.team + ' - ' + team.points + ' puan');
        });
    });

// 18. hafta fikstürleri
fetch('api.php?type=fixtures&week=18')
    .then(response => response.json())
    .then(fixtures => {
        fixtures.forEach(match => {
            console.log(match.home_team + ' vs ' + match.away_team);
        });
    });

// İstatistik özeti
fetch('api.php?type=stats')
    .then(response => response.json())
    .then(stats => {
        console.log('Toplam:', stats.total_fixtures, 'maç');
        console.log('Son güncelleme:', stats.last_update);
    });

API Endpoint'leri

Endpoint Açıklama Örnek
api.php Tüm veri Tüm fikstür, puan cetveli, gol krallığı
api.php?type=fixtures Sadece fikstürler Tüm haftaların maçları
api.php?type=fixtures&week=18 Hafta fikstürü Sadece 18. hafta
api.php?type=standings Puan cetveli Lig sıralaması
api.php?type=clubs Kulüpler Takım bilgileri
api.php?type=top_scorers Gol krallığı En golcü oyuncular
api.php?type=stats İstatistikler Genel sayılar

Güncelleme

Manuel Güncelleme

php scrape_tff.php

Otomatik Güncelleme (Cron)

# Crontab düzenle
crontab -e

# Her gün saat 02:00'da güncelle
0 2 * * * /usr/bin/php /path/to/cron_update.php >> /path/to/cron.log 2>&1

Veri Yapısı

Fikstür Verisi

{
    "week": 18,
    
Yorumlar0

Henüz yorum yok. İlk yorumu siz yazın.

Yorum yaz

İlgili

yazılım

Cotonti varnish cache

Supercharge your Cotonti website with Varnish Cache integration! This plugin seamlessly connects your Cotonti CMS with Varnish Cache, a powerful HTTP…

yazılım

Emlak Takip Yazılımı - Emlakçılara Özel

Emlak Takip Programı - Emlakçılara Özel symfony ile geliştirilen kiracı gelir gider- kira takibi mülk takibi mülk sözleşme sistemleri kişisel portfoy…

yazılım

Cotonti Nexus Themes

Cotonti CMF için özel üretilmiş kurumsal düzeyde premium bir tasarım ile eski Cotonti geleneğine veda eden bir tema.

Benzer bir iş üzerinde mi çalışıyorsunuz?
Mimariyi incelemekten teslimata kadar yardımcı olmaktan memnuniyet duyarım.

iletişim