TRANSMIS | Message transmis et reçu. |
NON_TRANSMIS | Message non transmis. |
DESTINATION_INVALIDE | Destination incorrecte. |
<accuses>
<message id="6" status="TRANSMIS"></message>
<message id="7" status="NON_TRANSMIS"></message>
<message id="8" status="DESTINATION_INVALIDE"></message>
</accuses>
<?php
/*
pré-requis :
- Une connexion SQL est établit
- Vous disposer d'une table LOGSMS permettant d'archiver vos SMS.
*/
$apikey = "Votre APIKey";
$xml_file = "http://www.envoyersms.biz/api/v1/accuses.php?apikey=".$apikey;
$data = file_get_contents($xml_file);
$xml = simplexml_load_string($data);
if ($xml)
{
foreach($xml->message as $item)
{
$attributes = $item->attributes();
$status = $attributes['status'];
$id = (int)$attributes['id'];
$sql = "UPDATE LOGSMS set etat = '$status' where id = ".$id;
mysql_query($sql);
}
}
?>