首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用Webservice : C# to php

使用Webservice : C# to php
EN

Stack Overflow用户
提问于 2014-11-07 21:19:08
回答 1查看 98关注 0票数 0

所以我在一个with服务上运行了一些测试,它在我的C#代码中运行得很好:

代码语言:javascript
运行
复制
    // The objet to do the request
            server.CustomerWS Auth = new server.CustomerWS();

    // The object we will use to store the request
            server.customerXML Cust = new server.customerXML();

            // Request
            Cust = Auth.authenticate(login, password);


            if (cust.retour == true)
            {
                MessageBox.Show("OK");
            }
            else
            {
                MessageBox.Show("KO");
            }

我需要将这段代码转换成PHP,作为一个完全的新手,我会得到任何帮助,我可以让我开始,主要的问题是我不知道如何处理来自PHP的get服务的对象。

我没有在服务器上使用php5,所以我不能使用soap php函数。

谢谢你的帮助

EN

回答 1

Stack Overflow用户

发布于 2014-11-07 21:34:20

代码语言:javascript
运行
复制
// -- specify your Web Service URL and also the login and password (should be really protected : use HTTPS and send these parameters in POST)    
$url = 'http://....';
// The objet to do the request
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);

// The object we will use to store the request
$result = NULL;

$xml = new SimpleXmlElement(curl_exec($curl)); 
if ($xml->retour[0] == true){ 
    print ("OK");
}else{
    print("KO");
}

希望这能有所帮助:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26802195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档