function executeCommand($params, $chatID) { // Prepare an array of parameters without the command for ($i = 1; $i < count($params); $i++) { $parameters[$i - 1] = $params[$i]; } $command = $params[0]; // Execute command if ($command == "/start") { start($chatID); } if ($command == "/help") { help($chatID); } if ($command == "/tex") { tex($chatID, $parameters); } }
// On crée le context pour la requète $context = stream_context_create( array( 'http' => array( 'method' => 'POST', 'content' => http_build_query($args) ) ) ); // Ici on va générer un nom et un chemin pour notre fichier final $hash = md5(serialize($txt)); $fichier = "cache-tex/qrcode-$hash.png"; // Si notre fichier n'existe pas on requète le service et on crée le fichier if ( !is_file( $fichier ) ){ file_put_contents( $fichier, file_get_contents( $url, false, $context ) ); } // On retourne un tag image avec la source qui va bien //return "<img src=\"$fichier\" alt='qrcode' width='$dim' height='$dim' class='middle' />"; return "$fichier"; } } $fichier= tex($txt); echo "<div class='$laclass'>"; echo "<img src=\"".$urlmst."$fichier\" alt='tex' class='middle' />"; echo "</div>"; } ?>