Website Design Nepal
Web Design Nepal, Website Design Nepal are the basic abstraction of this page.

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.

<?php
$client = new SoapClient("http://footballpool.dataaccess.eu/data/info.wso?wsdl");
$result = $client->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 "
    <table border='2'>
      <tr>
        <th>Rank</th>
        <th>Name</th>
        <th>Goals</th>
      </tr>
  ";
 
  foreach($array as $k=>$v){
    print "
      <tr>
        <td align='right'>" . ($k+1) . "</td>
          <td>" . $v->sName . "</td>
          <td align='right'>" . $v->iGoals . "</td>
        </tr>";
  }
 
  print "</table>";
}
else {
?>
 
  <form id="topscorers" action="1.php" method="post">
    How long should your topscorers list be? (Choose a digit between 1 and 20).
    <input id="topn" name="topn" size="2" type="text" value="10" />
    <input id="submit" name="submit" type="submit" value="submit" />
  </form>
 
<?php
}
?>
Yahoo BuzzWordPressStumbleUponShare
Tags: , , ,
Category : PHP, SOAP, WSDL, XML | 2 Comments »
© 2003-2012 Copyright , Young Minds, Kathmandu, Nepal. All rights reserved.