Пример #1
0
<?php

// This is a live demonstration on how to use the library
require_once dirname(__FILE__) . '/vendor/autoload.php';
// or if you don't use autoloading:
// require_once dirname(__FILE__) . '/src/TafDecoder.inc.php';
use TafDecoder\TafDecoder;
use TafDecoder\ChunkDecoder\ReportTypeChunkDecoder;
$raw_taf = '2013/11/03 18:54\\nTAF TAF LIRU 032244Z 0318/0406 CNL\\n';
print 'Demo, decoding raw taf "' . $raw_taf . '"' . PHP_EOL;
$decoder = new TafDecoder();
$decoded_taf = $decoder->parse($raw_taf);
print 'Report type: ' . $decoded_taf->getType() . PHP_EOL;
Пример #2
0
<?php

// This is a page to try the decoder through a web browser
require_once dirname(__FILE__) . '/../src/TafDecoder.inc.php';
include 'util.php';
use TafDecoder\TafDecoder;
use utilphp\util;
if (isset($_GET['taf'])) {
    $raw_taf = htmlspecialchars(trim($_GET['taf']));
} else {
    $raw_taf = '';
}
$decoder = new TafDecoder();
$d = $decoder->parse($raw_taf);
?>

<!DOCTYPE html>
<html>
    <head>
        <!-- Bootstrap over CDN -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
    </head>
    <body>
        <div class="container">
          
          <div class="header">
            <ul class="nav nav-pills pull-right">
                <li class="active">Live demo</li>
            </ul>