如何使用该url解析来自cellcom的响应?

问题描述:

我想从我的PHP脚本读取这个网址:如何使用该url解析来自cellcom的响应?

http://test.cellpay.com.np:8181/cellcom?FN=123&fromMobile=01670746301&phoneNumber=01670746301&PIN=123456&amount=0 

请先加载的URL,检查响应,并告诉我该怎么做。

我试过如下:

file_get_contents 
simplexml_load_string 
simplexml_load_file 
CURL 

未能在所有情况下。 我已经保存在XML,并上传到

http://vtopup.tk/1.xml 

我可以读这一点,但不是原来的一个。 请帮帮我。我厌倦了搜索和应用...

谢谢。

+0

SimpleXML肯定是最简单的方法。当你写'所有情况下都失败'时,当你调用'simplexml_load_file('http://test.cellpay.com.np:8181/cellcom?FN=ATW&fromMobile=testuser&phoneNumber=01670746301&PIN=z2ag&amount=0 ');' – Saeven 2015-02-06 19:01:10

+0

布尔(假),虽然网址是有效的,但它的工作http://vtopup.tk/1.xml的情况下 – Shuhail 2015-02-06 19:04:35

+0

@Shuhail然后你有另一个问题,也许有什么是“破”在你身边, – VeeeneX 2015-02-06 19:12:44

!!!!!!!!!终于解决了!!!!!!!!! 这就是所有关于PHP版本 我试图从PHP 5.4.27,不工作.... 终于尝试从PHP 5.6.3,它的工作原理。如此简单而神奇。

感谢Veenexfile_get_contents returns empty string 尽全力。

谢谢你们,非常感谢。

经过测试,它的工作。

<?php 
$url = 'http://test.cellpay.com.np:8181/cellcom?FN=ATW&fromMobile=testuser&phoneNumber=01670746301&PIN=z2ag&amount=0'; 
$xml = simplexml_load_file($url) or die("feed not loading"); 
var_dump($xml); 
+0

我把你的代码...但是...警告:simplexml_load_file():在/home/icetopup/public_html/api/index.php在线3 警告:simplexml_load_file():^ in/home/icetopup第3行的/public_html/api/index.php feed未加载[请检查http://icetopup.tk/api/index.php] – Shuhail 2015-02-06 19:14:34

+0

@Shuhail你可以试试'$ url ='http:// test。 cellpay.com.np:8181/cellcom?FN=ATW&fromMobile=testuser&phoneNumber=01670746301&PIN=z2ag&amount=0' ; \t $ data = file_get_contents($ url); \t var_dump($ data);' – VeeeneX 2015-02-06 19:23:10

+0

string(0)“”。你是否从你的最后得到了回应? – Shuhail 2015-02-06 19:24:50