PHP Classes

File: vendor/react/dns/examples/12-all-types.php

Recommend this page to a friend!
  Classes of Hillary Kollan   Chatto PHP Websocket Chat System   vendor/react/dns/examples/12-all-types.php   Download  
File: vendor/react/dns/examples/12-all-types.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Chatto PHP Websocket Chat System
Websocket based chat system using Ratchet library
Author: By
Last change:
Date: 3 years ago
Size: 767 bytes
 

Contents

Class file image Download
<?php

// $ php examples/12-all-types.php
// $ php examples/12-all-types.php myserverplace.de SSHFP

use React\Dns\Config\Config;
use
React\Dns\Resolver\Factory;

require
__DIR__ . '/../vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

$config = Config::loadSystemConfigBlocking();
$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';

$factory = new Factory();
$resolver = $factory->create($server, $loop);

$name = isset($argv[1]) ? $argv[1] : 'google.com';
$type = constant('React\Dns\Model\Message::TYPE_' . (isset($argv[2]) ? $argv[2] : 'TXT'));

$resolver->resolveAll($name, $type)->then(function (array $values) {
   
var_dump($values);
}, function (
Exception $e) {
    echo
$e->getMessage() . PHP_EOL;
});

$loop->run();