Good afternoon, I'm making a website to send sms to customers, so far I have managed to use the api that provides the sms service contracted, it would be something like this:
<script>
function enviar(telefono,mensaje){
//document.getElementById("frame_mensaje").src = "https://comunik.jmeservicios.com/api/sms?api_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx="+telefono+"&from=XXXXXX&message="+mensaje+"&gsm7=1";
}
</script>
<iframe src="" name="frame_mensaje" id="frame_mensaje"></iframe>
... to simplify, let's say we have a frame with the src in white, that when clicking on a table, it returns the phone and the message and loads them in the send function, which changes the src of the frame. So all right, the SMS is sent and the frame loads me an answer xml.
The API also allows me to add (& callback_url = http% 3A% 2F% 2Fwww.urldecallback.com% 3Fmy_delivery% 3D333444), which I understand could be a php that collects the xml response, which comes in this format:
<sms>
<status>SENT</status>
<credits>1</credits>
<remain>99952</remain>
<messages>
<message jme_id="xxxxxxx-xxxxxx-xxxxx-x-xxxxxxx" to="+34xxxxxxxxx" status="SENT" type="sms" credits="1" sms_count="1" send_date="2015-01-12T12:00:59"/>
</messages>
</sms>
The question is: How do I convert this response into php variables ?. I have searched for information and with the function "simplexml_load_string ($ xml_file)" I can separate the xml data and assign them to variables, but how do I load the xml in "$ xml_file"? How should I start that php file that collects the server response ?
I "defend" a bit in javascript and php ... but the xml is something new for me. Thank you very much for the help.