Parsing xmlstatus through php | Search |
NowSMS Support Forums ⬆ NowSMS Support - SMS Issues ⬆ Archive through December 14, 2010 ⬆ |
◄ ► |
Author | Message | |||
Steve Rike New member Username: Stever Post Number: 1 Registered: 09-2010 |
I am trying to read xml url from xmlstatus and parse the info through a php script to display some data and numbers on the web publicly for my web visitors; I already searched on this forum and almost gone through every single details and tried to read the data from the url $InfoUrl = 'http://127.0.0.1:8800/admin/xmlstatus?user=adminuser&password=adminpass'; by using many ways such as 1. $response = simplexml_load_file($InfoUrl); 2. $response = file_get_contents($InfoUrl); 3. $response = fopen($InfoUrl, r); 4. by curl such as curl_setopt($ch, CURLOPT_URL,$InfoUrl); But unfortunately none of the mentioned ways above worked for me , I even tried to read and display the xml text as is but still no luck. I'm not a php/xml expert, so I'm scratching my head as where to look for such thing. Note: above url is just demo and yes I replaced the info to my appropriate login access; in fact I ~can~ see all the nice xml data if I access the url directly through a browser so the issue is how to read it and display it nicely in a php script, at the moment I am only interested to display SMSOUTQ number. Thank you for your help in advance. Steve R. | |||
Des - NowSMS Support Board Administrator Username: Desosms Post Number: 2540 Registered: 08-2008 |
Hi Steve, Sorry for taking so long to reply. I had meant to investigate this earlier in the week, but ran out of time. I've never done this before, but I figured this would be a good learning exercise. Here is a simple PHP routine that will extract the <SMSOUTQ> value. $xmldata = file_get_contents("http://127.0.0.1:8800/admin/xmlstatus?user=adminuser&password=adminpass"); $xml = simplexml_load_string($xmldata); echo $xml->SMSOUTQ; $xml->SMSOUTQ contains the value that you are after. -- Des NowSMS Support | |||
Steve Rike New member Username: Stever Post Number: 2 Registered: 09-2010 |
That worked fine; thank you for the help. |