PHP SOAP WSDL Script

Below is a simple example on how to use SOAP-WSDL with PHP. This example will help you pull data from WSDL using SOAP in PHP.

TopGoalScorers(array('iTopN'=>5));

if ($_POST['topn'] > 0 && (int) $_POST['topn'] <= 20){
  $topn = (int) $_POST['topn'];
  $client = new SoapClient("http://footballpool.dataaccess.eu/data/info.wso?wsdl");
  $result = $client->TopGoalScorers(array('iTopN' => $topn));
  // Note that $array contains the result of the traversed object structure
  $array = $result->TopGoalScorersResult->tTopGoalScorer;

  print "
    
  ";
  
  foreach($array as $k=>$v){
    print "
      ";
  }
  
  print "
Rank Name Goals
" . ($k+1) . " " . $v->sName . " " . $v->iGoals . "
"; } else { ?>
How long should your topscorers list be? (Choose a digit between 1 and 20).