PHP Call HTTP SMS interface (return value is XML), in PHP How to extract the value inside

Source: Internet
Author: User
PHP Call HTTP SMS interface (return value is XML), in PHP How to extract the value inside?
The value returned by this HTTP interface is the following style


status-------return state value: Successful return success failed return: Faild
Message--------------return information hint: see table below

I run PHP after the page out: sucess Prepaid
On the page is $result = file_get_contents ($gateway);

echo ' return result '. $result;

How can I use two variables to accept the success and the prepaid two values respectively? Ask the expert to answer!

Share to:


------Solution--------------------
Why do you want to use $result = file_get_contents ($gateway);
Isn't there a special XML format to accept?
------Solution--------------------
$result =<<< XML


Status
Message

XML;
$xml = simplexml_load_string ($result);
echo $xml->returnstatus, ", $xml->message;
Status message
------Solution--------------------
He returns what I don't know but you should know
If you are not clear, print_r ($xml); Take a look
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.