/* *************************************** * mini Nabz Messenger Series v.2.55 *************************************** */ require_once('configuration.php'); $nabaztag = ""; function get_content($url){ global $UseCurl; if ($UseCurl == "OUI") { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_TIMEOUT, 20); curl_setopt ($ch, CURLOPT_HTTPHEADER, array( "Content-Type: text/xml; charset=UTF-8", "Accept-Language: fr-fr", )); ob_start(); curl_exec ($ch); $infoHTTP = curl_getinfo ($ch,CURLINFO_HTTP_CODE); $infoERR = curl_error($ch); curl_close ($ch); $string = ob_get_contents(); ob_end_clean(); if (substr($infoHTTP,0,1) == "2") { return $string; } else { return "Erreur HTTP ".$infoHTTP." / ".$infoERR; } } else { $response = ""; $parsed_url = parse_url($url); $host = $parsed_url["host"]; $path = $parsed_url["path"]; $query = $parsed_url["query"]; $port = 80; $fp = fsockopen($host, $port); if (!$fp) { return "Connexion impossible: Unknown Host"; } else { $com = "GET ".$path."?".$query." HTTP/1.0\r\nAccept-Language: fr-fr\r\n\r\n"; fputs($fp, $com); while (!feof($fp)) { $response .= fread($fp, 500); } fclose($fp); $httpStatus = substr($response, 0, strpos($response, "\r\n")); $string = substr($response, strpos($response, "\r\n\r\n") + 4); if (substr($httpStatus, 0, 10) == "HTTP/1.1 2") { return trim($string); } else { return $httpStatus; } } } } if (isset($_POST['tts'])){ $tts = str_replace("\\'","",$_POST['tts']); $urlNabaztag = $UrlAPI."?key=".$Maclef."&sn=".$MonSerial."&token=".$MonToken."&idapp=99&tts="; if ($_POST['ttsSign'] != "" & isset($_POST['ttsSign'])){ $ttsSign = str_replace("\\'","",$_POST['ttsSign']); $urlNabaztag .= rawurlencode(utf8_encode("Message de ".$ttsSign." : ")); } $urlNabaztag .= rawurlencode(utf8_encode($tts)); $nabaztag = get_content($urlNabaztag); }else{ $nabaztag = ""; } ?>