Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php web service example [closed]

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...

like image 230
Miya Avatar asked Nov 22 '10 04:11

Miya


2 Answers

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/

like image 153
bcosca Avatar answered Sep 22 '22 19:09

bcosca


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/

like image 30
Bogdan Ciocoiu Avatar answered Sep 22 '22 19:09

Bogdan Ciocoiu