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