【发布时间】:2015-04-06 12:04:39
【问题描述】:
我需要 ping 该 URL 并接收响应:
http://test.cellpay.com.np:8181/cellcom?FN=123&fromMobile=01670746301&phoneNumber=01970746301&PIN=1234567890&amount=0
响应是 XML 格式的。我正在尝试使用 PHP 读取响应。 如果我使用:
file_get_contents($url);
它显示:
file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0
如果我使用:
file_get_contents($url);
它显示:
bool(false)
Uncaught exception 'Exception' with message 'String could not be parsed as XML'
我不知道该怎么办,请帮帮我。
谢谢。
【问题讨论】:
-
更改第一条错误信息中给出的设置,或寻找新主机。
-
您可以使用 PHP xml 解析器。也许这可以帮助你stackoverflow.com/questions/188414/best-xml-parser-for-php
-
我已经与我的托管服务器交谈并启用了 url_fopen。但它仍然返回 bool(false) 。您的链接建议如何处理数据。但我在接收数据时遇到问题。请告诉我如何接收数据。请检查链接[链接]test.cellpay.com.np:8181/…是xml吗?