简体   繁体   English

PHP如何使用远程https WCF Web服务

[英]PHP how to consume a remote https WCF webservice

Im trying to consume a WCF webservice using get or post with php , it is a great example, it works locally but I need to make it work remotelly. 我试图使用get或post与php一起使用WCF Web服务,这是一个很好的例子,它在本地工作,但是我需要使其在远程工作。

The code is a great test example because it allows you to see both the get and post requests. 该代码是一个很好的测试示例,因为它使您可以查看get和post请求。

This is a model of the url (not the real one). 这是url的模型(不是真实的)。

https://anyweb.com/anyservice.svc/GetShops https://anyweb.com/anyservice.svc/GetShops

This is the error from the server 这是来自服务器的错误

The exception message is 'Invalid value for 'encryptedTicket' parameter.' 异常消息是“'encryptedTicket'参数的值无效”。

What should I do to solve it? 我该怎么解决? It seems there is not to much written about this. 似乎对此没有太多的文字记载。

The code below 下面的代码

<?php
echo 'Call the service using GET <br>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://anyweb.com/anyservice.svc/GetShops".
                    "");
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

$result = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

print_r($result);
echo '<br>';

echo '<br>Call the service using POST <br>';


$transmitObject = array("fname" => "MASTER", "lname" => "POGI");




$jsonObject = json_encode($transmitObject);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://anyweb.com/anyservice.svc/GetShops");
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonObject);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

$result = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);
print_r($result);
?>

您为cryptonTicket发布的值或数据类型是错误的阅读他们的文档,并查看他们的Web服务对该字段期望收到什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM