PHP SOAP 使用示例
2013-12-14 17:46
369 查看
soap_client.php
soap_server.php
访问:http://localhost/soap_client.php
<?php try { $client = new SoapClient( null, array('location' =>"http://localhost/soap_server.php",'uri'=>"http://test-uri") ); echo $client->getVar(); } catch (SoapFault $fault){ echo "Error: ".$fault->faultcode."<br/> String: ".$fault->faultstring; }
soap_server.php
<?php $soap = new SoapServer(null,array('uri'=>"http://test-uri")); $soap->setClass('MyClass'); $soap->handle(); class MyClass { public $var = 'Hello'; function getVar() { return xmlrpc_encode($this->var); } } ?>
访问:http://localhost/soap_client.php
相关文章推荐
- PHP SOAP 使用示例
- php接口和抽象类使用示例详解
- php设计模式之命令模式使用示例
- 使用php测试硬盘写入速度示例
- PHP 中使用 SOAP(2)
- PHP中可以自动分割查询字符的Parse_str函数使用示例
- 【ZZ】一些在php中使用header函数设置http头的示例方法
- 使用zeng studio 创建的php调用webservice soap简单实例
- php使用socket编程示例
- php使用Jpgraph创建折线图效果示例
- php使用Jpgraph创建柱状图展示年度收支表效果示例
- PHPExcel的使用方法和代码示例
- PHP实现的汉字拼音转换和公历农历转换类及使用示例
- PHP使用SOAP扩展实现WebService的方法
- 使用zeng studio 创建的php调用webservice soap简单实例
- php定义数组和使用示例(php数组的定义方法)
- php输入流php://input使用示例(php发送图片流到服务器)
- php使用websocket示例详解
- 关于PHP的使用NuSoap来架设soap服务webservice
- php使用自定义函数实现汉字分割替换功能示例