【发布时间】:2015-07-23 07:11:18
【问题描述】:
我正在尝试调用一个基本上如下所示的 Web 服务:
http://10.10.10.10:8080/gw/someAction?amount=10&description='Some description'
所以我就是这样称呼这个网络服务的:
$endpoint = "http://10.10.10.10:8080/gw/someAction?amount=10&description='Some description'";
$opts = array('http' =>
array(
'method' => 'GET',
'header' => 'Content-type: application/xml'
)
);
$context = stream_context_create( $opts );
$result = file_get_contents( $endpoint, false, $context );
$xml_result = simplexml_load_string( $result );
echo $xml_result->success;
所以在这里,我什么都没有,xml_result 是空的。这是有趣的部分 - 当我从描述中删除空格时:
http://10.10.10.10:8080/gw/someAction?amount=10&description='Somedescription'
一切都很好,我从网络服务中得到了答案。还尝试使用描述中的空白区域使用 chrome rest 客户端调用 Web 服务,一切正常,我有响应。因此,这导致我在这里遇到某种 PHP 问题,其中包含 Web 服务中的空格。请帮忙!
更新:
print_r($result)
结果
1
【问题讨论】:
标签: php web-services