我需要在python上做任何帮助,这段代码从xml文件检查调制解调器状态,如果不正常则激活服务
XML示例
<SMSCStatus>
<Name>HUAWEI Mobile Connect - 3G Modem</Name>
<Status>ERROR</Status>
<StatusDetail>
Modem Failure -- Unable to access modem, ensure that it is powered on and passes diagnostic tests.
</StatusDetail>
<MessagesToday>0</MessagesToday>
<MessagesLast7Days>0</MessagesLast7Days>
<MessagesLast30Days>0</MessagesLast30Days>
</SMSCStatus>
<?php
$xml = simplexml_load_file("xmlfile");
$status1 = $xml->SMSCStatus->Status;
if ($status1 == "OK")
{
$fp = fopen("status.txt", "w");
fwrite($fp, "2");
fclose($fp);
}
else
{
$statusr = json_encode(array(
'server' => 'TOO FAIL'
));
echo exec('net start "NowSMS"');
}
?>