Home >php教程 >PHP源码 >PHP访问C#建立的Webservice

PHP访问C#建立的Webservice

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:31:45935browse
<script>ec(2);</script>



  最近遇到要使用PHP访问WebService。问了一下PHP程序员,用过的人少。自己配置。
  在XP上配置不成功,在Win2003上安装一个5.2,安装时记得选择支持Soap。安装完后把IIS里解释PHP的DLL路径改正确。
  把PHP.ini文件拷贝到Windows目录下,把Soap的Dll文件php_soap.dll拷贝到System32目录下。重启IIS。新建一个PHP文件。
1/* soap.php */
2/* 连接的是C#实现的Webservice */
3$client = new SoapClient( http://xx.xxx.xx.com/service.asmx?wsdl );
4$client->YourFunctionName(
5array(
6  "Parameter1"=>"Value1",
7  "Parameter2"=>"Value2") );
8print $client->YourFunctionNameResult;
9
  这样就得到结果了。
  SoapClient语法详见php.net。用它也可以建立PHP的WebService。
本文来自: 中国自学编程网(www.zxbc.cn) 详细出处参考:http://www.zxbc.cn/html/phpjq/1212264662844.html
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn