php web服务示例

时间:2010-11-22 04:44:07

标签: php web-services

我是网络服务新手。我想用PHP获得一个很好的教程和Web服务示例。请向我推荐一些以简单方式解释这些内容的网站。

谢谢...

4 个答案:

答案 0 :(得分:31)

答案 1 :(得分:3)

这就是你需要的。

确保你安装了Zend Framework - 无论如何,如果你没有安装它,它会说明如何安装它。

关于它的好处是它允许发现 - 网上的其他教程不是基本的POST / GET - 没有发现服务。

<?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();


?>

谢谢, 波格丹

PS:关注此帖子,因为它是解决方案的来源,并且不断更新:http://www.getcomputerservices.co.uk/web-development/php-web-service-with-microsoft-discovery/

答案 2 :(得分:1)

答案 3 :(得分:0)

相关问题