reactphp/dns

request inner host , error: DNS Request did not return valid answer.

cclehui opened this issue · 2 comments

`<?php

require("./vendor/autoload.php");

$loop = React\EventLoop\Factory::create();
$client = new React\HttpClient\Client($loop);

$url = "http://www.test.com/temp/test.php";

$request = $client->request('GET', $url);
$request->on('response', function ($response) {
$response->on('data', function ($chunk) {
writeLog($chunk);
});
$response->on('end', function() {
writeLog('DONE');
});
});
$request->on('error', function (\Exception $e) {
writeLog("error: \t" . $e->getMessage());
});

writeLog("1111111111111111");

$request->end();

writeLog("2222222222222222");
$loop->run();

function writeLog($log_str) {

echo $log_str . "\n";

}`

www.test.com is inner dns , code like this get a error: DNS Request did not return valid answer.

browser can open the website

What's inner DNS? Do you mean an internal DNS server?

clue commented

The React\HttpClient\Client defaults to using the public DNS 8.8.8.8 and does in fact offer an API to explicitly set a custom DNS server. Can you file an issue in react/http so we can address this documentation issue? Thank you! 👍