0

I am trying to read this url from my php script:

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

please load the url first, check the response and tell me what to do.

I tried the following:

file_get_contents
simplexml_load_string 
simplexml_load_file
CURL

failed in all cases. I've saved the xml and upload it to

http://vtopup.tk/1.xml

I can read this, but not the original one. Please help me. I am tired of searching and applying...

Thanks.

Shuhail
  • 58
  • 1
  • 9
  • SimpleXML is certainly the easiest way to go. When you write 'failed in all cases', what did you see specifically, when you call `simplexml_load_file( 'http://test.cellpay.com.np:8181/cellcom?FN=ATW&fromMobile=testuser&phoneNumber=01670746301&PIN=z2ag&amount=0' );` – Saeven Feb 06 '15 at 19:01
  • bool(false), while the url is valid, but it works in case of http://vtopup.tk/1.xml – Shuhail Feb 06 '15 at 19:04
  • @Shuhail Then you have another problem maybe something is "broken" on your side, – VeeeneX Feb 06 '15 at 19:12
  • yeh! for sure! but could not find out.... I am just going mad.... same code run for different url, and same url run in my browser, that means both url and my code is fine... but could not matched... – Shuhail Feb 06 '15 at 19:17

2 Answers2

0

Tested and it's working.

<?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);
VeeeneX
  • 1,556
  • 18
  • 26
  • I put your code... but... Warning: simplexml_load_file(): in /home/icetopup/public_html/api/index.php on line 3 Warning: simplexml_load_file(): ^ in /home/icetopup/public_html/api/index.php on line 3 feed not loading [please check http://icetopup.tk/api/index.php] – Shuhail Feb 06 '15 at 19:14
  • @Shuhail Can you please try `$url = 'http://test.cellpay.com.np:8181/cellcom?FN=ATW&fromMobile=testuser&phoneNumber=01670746301&PIN=z2ag&amount=0'; $data = file_get_contents($url); var_dump($data);` – VeeeneX Feb 06 '15 at 19:23
  • string(0) "". are you getting the response from your end? – Shuhail Feb 06 '15 at 19:24
  • @Shuhail Yes, I've got a response so maybe your ip is blocked or something like that. You can try ping to it from a server. – VeeeneX Feb 06 '15 at 19:27
  • I am trying it from a server http://icetopup.tk/api/index.php, should I try it from my localhost? – Shuhail Feb 06 '15 at 19:30
  • @Shuhail Try it from a server icetopup.tk – VeeeneX Feb 06 '15 at 19:32
  • yes, I am trying from the server of icetopup.tk, all files are hosted there. I put your code on http://icetopup.tk/api/index.php, may be my server's ip is blocked for several times pinging.... I am trying from another server. – Shuhail Feb 06 '15 at 19:34
  • I tried from different server, but it shows bool(false), http://www.letsshopbd.com/css/index.php. could you please tell me exactly what is the response on your end? I am out of my mind.... – Shuhail Feb 06 '15 at 19:48
  • I don't know what to do... what you suggest now? are you testing from localhost? or live server? can I have the url of your response? please tell me something – Shuhail Feb 06 '15 at 19:57
  • @Shuhail I'm testing from local machine, I can't give you url, maybe you can contact provider of your server. – VeeeneX Feb 06 '15 at 20:12
0

!!!!!!!!!Finally solved!!!!!!!!! Thats all about php versions I was trying from PHP 5.4.27, doesn't work.... Finally tried from PHP 5.6.3 and it works. so simply and magically.

Thanks to Veenex and file_get_contents returns empty string for all effort.

Thank you guys, thank you very much.

Community
  • 1
  • 1
Shuhail
  • 58
  • 1
  • 9