Exercise: PHP consuming SOAP webservice, Football information

In this exercise you must consume a SOAP webservice using SoapClient(...)

Getting ready

Try some of the functions from the Football SOAP service from the browser http://footballpool.dataaccess.eu/data/info.wso

And learn some SOAP. This will be useful when you later call the functions from PHP.

Getting started

Make the example https://www.vankouteren.eu/blog/simple-php-soap-example/ work on your computer.

Do not spend (much) time trying to read the WSDL file.

Try to show a list of 1 players.

Show the response

Show the response called $array in the example.

The PHP function print_r(...) might be handy.

Show flags

The response includes a reference to the players contry flag.

Add another column to the output table: The flag for each player.

Hint: HTML images

Stadium names

Show a list of stadium names

Use print_r($result) to observe the structure of the result.

How to get into (using ->) the $result to get the stadium names array.

Iterate the array using a foreach loop.

Extra: Stadium info

We want more information about each stadium - not just the names.

These lines can give you more information

$resultDetail = $client->StadiumInfo(array('sStadiumName' => $name));
$details = $resultDetail->StadiumInfoResult;

Show the information similar to this

Stadium information

Extra: Teams

Show information about teams: Name, flag, etc.

$client = new SoapClient("http://footballpool.dataaccess.eu/data/info.wso?wsdl");
$result = $client->Teams();