【发布时间】:2010-11-22 04:44:06
【问题描述】:
我是网络服务的新手。我想获得一个很好的使用 PHP 的 Web 服务教程和示例。请向我推荐一些以简单方式解释这些事情的网站。
谢谢...
【问题讨论】:
标签: php web-services
我是网络服务的新手。我想获得一个很好的使用 PHP 的 Web 服务教程和示例。请向我推荐一些以简单方式解释这些事情的网站。
谢谢...
【问题讨论】:
标签: php web-services
【讨论】:
这就是你需要的。
确保您已安装 Zend 框架 - 它说明了如果您没有安装它,无论如何如何安装它。
它的好处是它允许发现 - 网络上的其余教程不是基本的 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/
【讨论】:
【讨论】:
我使用这个源代码。它是一个 SOAP 示例:http://www.java2s.com/Code/Php/Web-Services-SOAP-WSDL/CatalogWeb-Services-SOAP-WSDL.htm
【讨论】: