xml响应错误
当我尝试发送 xml 消息并期望得到响应时,出现 SSL 连接超时错误:
$xml = <<<EOL
<?xml version='1.0' encoding='UTF-8'?>
<abc>
<UserId>123</UserId>
</abc>
EOL;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('xmlmessage' => $xml));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
$result = curl_exec($ch);
if ($result === FALSE) {
die(curl_error($ch));
}
echo $result
有人可以帮忙吗?
I get SSL connection timeout error when I try sending xml message and expect a response:
$xml = <<<EOL
<?xml version='1.0' encoding='UTF-8'?>
<abc>
<UserId>123</UserId>
</abc>
EOL;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('xmlmessage' => $xml));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
$result = curl_exec($ch);
if ($result === FALSE) {
die(curl_error($ch));
}
echo $result
Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在上面的代码中,您缺少:
除此之外,您需要确保curl具有ssl支持。创建一个名为“test.php”的文件并将以下内容放入其中:
然后通过浏览器加载页面。在输出中,向下滚动到页面的“中间”,其中
您可以查看有关已安装/启用的模块的详细信息。查找卷曲信息。如果有 SSL 支持
你会看到类似的东西(注意它如何“提到”ssl):
否则你需要联系服务器管理员让他/她安装 ssl 支持。
On the code above you are missing:
Other than that, you need to make sure curl has ssl support. Create a file named "test.php" and put the following in it:
then load the page via your browser. On the output, scroll down towards the "middle" of the page where
you can see details about the modules installed/enabled. Look for the curl information. If it has SSL support
you will see something SIMILAR to (notice how it "mentions" ssl):
Otherwise you'll need to contact the server admin to have him/her install ssl support for it.