Comments (3)
Hey @webaddicto, have a look at https://github.com/reactphp/async#async that should help you do this. You're code will become something like:
$details = array();
$domain = "google.com";
$type_a = await($resolver->resolveAll($domain, Message::TYPE_A));
if(!isset($type_a['exceptionMessage'])) {
foreach($type_a as $record) {
$details[$domain]['ips'][] = $record->ip;
}
} else {
$details[$domain]['exception'] = $type_a['exceptionMessage']; // DNS query for example.com (A) did not return a valid answer (NOERROR / NODATA)
}
print_r($details);
from dns.
Thanks @webaddicto 👍
-
It seems like
sleep()
is not exactly the thing you're looking for. You can take a look at @clue's answer in reactphp/dns#152, this should fit your needs. -
Like @WyriHaximus this one sounds a lot like you want to use
await()
. For that you can take a look at https://github.com/reactphp/async. Additionally your$type_a
gets an array after awaiting (in @WyriHaximus example) and because of that you need to work withtry{} catch{}
afterwards instead of yourif{} else{}
.
I hope this helps 👍
from dns.
I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this 👍
from dns.
Related Issues (20)
- Support extended DNS (EDNS0)
- PHP Fatal error: Maximum function nesting level of '256' reached, aborting! Protocol/Parser.php on line 293 HOT 14
- DNS Cache is not used when the type of the response record is CNAME HOT 3
- Gate way issue Discord HOT 1
- Roadmap to stable v1.0.0 HOT 4
- Ask host OS for DNS service address at startup, if none given by caller HOT 3
- getting ttl value HOT 1
- querying for SOA but got CNAME instead of empty answer or error HOT 2
- Connection to DNS server lost HOT 1
- Support DNS search domain list (resolve local hostname to FQDN) HOT 3
- Question: I like the pure PHP DNS client. Can I use it without the $loop in a non-PHP react project? HOT 1
- Exceptions constantly thrown in debugger HOT 12
- Test failure because f integer overflow on 32-bit system HOT 1
- Question using protocol classes directly HOT 4
- Mark current version as stable / memory limit exceeded HOT 1
- How to store data in array when doing resolveAll()? HOT 2
- Failure modes HOT 8
- Consider supporting "Special-Use Domain Names" (.localhost, .invalid etc.) HOT 1
- Consider supporting advanced DNS config (nsswitch,conf, hosts.conf, resolv.conf options and ENV variables etc.) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dns.