Example #1
0
$loader = new Twig_Loader_Array(['index' => '
a = {{ a }}
b = {{ b }}
c = {{ c }}
{% if d %}
d = {{ d }}
{% endif %}
				']);
$twig = new Twig_Environment($loader);
$dnsResolverFactory = new React\Dns\Resolver\Factory();
$dnsResolver = $dnsResolverFactory->createCached('127.0.0.1', $loop);
$factory = new React\HttpClient\Factory();
$client = $factory->create($loop, $dnsResolver);
$http->on('request', function ($request, $response) use($loop, $twig, $client) {
    $url = "http://monster.akond.dev/tmp.test.php";
    $context = new Context($client, $loop, $response);
    $context->then(function () {
        return date('r');
    })->run();
    return;
    $context->must($url . '?a', 'a')->must($url . '?b', 'b')->must($url . '?c', 'c')->must($url . '?d', 'd')->must($url . '?e', 'e')->must($url . '?f', 'f')->must($url . '?g', 'g')->must($url . '?h', 'h')->must($url . '?i', 'i')->then(function ($data) use($twig) {
        return var_export($data, true);
        return 1;
        return $twig->render('index', $data);
    })->run();
});
$interface = '127.0.0.1';
$port = 1337;
$socket->listen($port, $interface);
echo "Start listening on {$interface}:{$port}\n";
$loop->run();