I am new to web services. I would like to get a good tutorial and example for web service using PHP. Please suggest to me some websites that explain these things in a simple way.
Thank you...
Here are some links to get you started:
http://davidwalsh.name/web-service-php-mysql-xml-json
http://www.ibm.com/developerworks/opensource/tutorials/os-php-webservice/
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.
<?php ini_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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With