PHP code example of drsdre / yii2-xmlsoccer

1. Go to this page and download the library: Download drsdre/yii2-xmlsoccer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drsdre / yii2-xmlsoccer example snippets


'components' => [
    'xmlsoccerApi' => [
        'class' => '\drsdre\yii\xmlsoccer\Client',
        'apiKey' => 'xxx',
        'serviceUrl' => 'http://www.xmlsoccer.com/FootballData.asmx',
    ]
    ...
]

$client = new \drsdre\yii\xmlsoccer\Client([
    'apiKey' => 'xxx',
    'serviceUrl' => 'http://www.xmlsoccer.com/FootballData.asmx',
]);

'components' => [
    'xmlsoccerApi' => [
        'class' => '\drsdre\yii\xmlsoccer\Client',
        'apiKey' => 'xxx',
        'cache' => [
            'class' => '\yii\caching\FileCache'
        ],
    ]
    ...
]

$client = new \drsdre\yii\xmlsoccer\Client([
    'apiKey' => 'xxx',
    'serviceUrl' => 'http://www.xmlsoccer.com/FootballData.asmx',
    'serviceIp' => '192.168.1.1',
]);

try {
    $client = new \drsdre\yii\xmlsoccer\Client([
        'apiKey' => 'xxx',
    ]);
    $players = $client->getPlayersByTeam('49');
    echo "Players List:<br>";
    foreach($players as $key => $value) {
        echo "<b>".$value->Name."</b> ".$value->Position."<br>";
    }
}
catch(Exception $e) {
    echo "XMLSoccer Exception: ".$e->getMessage();
}

try {
    $client = new \drsdre\yii\xmlsoccer\Client([
        'apiKey' => 'xxx',
    ]);
    $client->setRequestIp("ip_for_request");
    $leagues = $client->getLeagueStandingsBySeason('3', '1516'));
    var_dump($leagues);
}
catch(Exception $e) {
    echo "XMLSoccer Exception: ".$e->getMessage();
}

try{
    $client = new \drsdre\yii\xmlsoccer\Client([
        'apiKey' => 'xxx',
        'serviceUrl' => 'http://www.xmlsoccer.com/FootballDataDemo.asmx',
    ]);
    $fixtures = $client->getFixturesByDateIntervalAndLeague('2016-01-01 00:00', '2016-02-01 00:00', '3'));
    var_dump($fixtures);
}
catch(Exception $e){
    echo "XMLSoccer Exception: ".$e->getMessage();
}