php web service example [closed] php web service example [closed] php php

php web service example [closed]


This is what you need.

Make sure you habe Zend Framework installed - it says how to install it if you don't have it, anyway.

The good thing about it is that it allows Discovery - the rest of the tutorials on the net don't are basic POST/GET - no discovery of services.

<?phpini_set('include_path', '/usr/share/php/libzend-framework-php/');require_once 'Zend/Soap/AutoDiscover.php';require_once "Zend/Soap/Server.php";class BogdansInjectData { private $quotes = array(    "one" => "answer one");    /**   * @param string $quote   * @return string  */  function PushData($quote) {    /* just encase the string is in uppercase*/    $symbol = strtolower($quote);    /* if there is a quote for the day requested */    if (isset($this->quotes[$quote])) {      return $this->quotes[$quote];    } else {      /* else error */      throw new SoapFault("Server","Unknown Symbol '$quote'.");    }  }}// if(isset($_GET['wsdl'])) {$autodiscover = new Zend_Soap_AutoDiscover();$autodiscover->setClass('BogdansInjectData');$autodiscover->handle();?>

Thanks,Bogdan

PS: Follow this post as it's the source for the solution and it's constantly updated: http://www.getcomputerservices.co.uk/web-development/php-web-service-with-microsoft-discovery/