PHP client for XMLSoccer API
Full API Documentation here: https://xmlsoccer.zendesk.com/hc/en-us
PHP5.5+, CURL, SimpleXML extensions.
Go to Getting_started and receive API key.
Include the XMLSoccer.php file, and call one of available methods.
Go to http://www.xmlsoccer.com/FootballData.asmx for more info about methods and parameters.
include("XMLSoccer.php");
try{
$soccer=new XMLSoccer("your_api_key");
$players=$soccer->GetPlayersByTeam(array("teamid"=>49));
echo "Players List:<br>";
foreach($players as $key=>$value){
echo "<b>".$value->Name."</b> ".$value->Position."<br>";
}
}
catch(XMLSoccerException $e){
echo "XMLSoccerException: ".$e->getMessage();
}
include("XMLSoccer.php");
try{
$soccer=new XMLSoccer("your_api_key");
$soccer->setRequestIp("ip_for_request");
$result=$soccer->GetLeagueStandingsBySeason(array("league"=>3,"seasonDateString"=>"1314"));
var_dump($result);
}
catch(XMLSoccerException $e){
echo "XMLSoccerException: ".$e->getMessage();
}
include("XMLSoccer.php");
try{
$soccer=new XMLSoccer("your_api_key");
$soccer->setServiceUrl("http://www.xmlsoccer.com/FootballDataDemo.asmx");
$result=$soccer->GetFixturesByDateIntervalAndLeague(array("league"=>3,"startDateString"=>"2014-08-01 00:00","endDateString"=>"2014-09-30 00:00"));
var_dump($result);
}
catch(XMLSoccerException $e){
echo "XMLSoccerException: ".$e->getMessage();
}
$soccer->setTimeout(60);