PHP code example of petercoles / xml-soccer

1. Go to this page and download the library: Download petercoles/xml-soccer 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/ */

    

petercoles / xml-soccer example snippets

unit.xml.dist
unit.xml
 php
use PeterColes\XmlSoccer\ApiClient;

class MyRequest()
{
    ...

    public function getLiveData()
    {
        $client = new ApiClient('YOUR_API_KEY_HERE', true));  // for the demo service

        $response = $client->getLiveScore()->get();
    }

    ...
}
 php
$client->getNextMatchOddsByLeague([ 'league' => 3 ]);
$client->GetFixturesByLeagueAndSeason([ 'league' => 3, 'seasonDateString' => '0506' ]);
 php
foreach ($object->Match[23]->HomeGoalDetails as $goal) {
    echo $goal->Minute;   
    echo $goal->Player;   
    echo $goal->Own;   
}