Gabriel Bianconi Gabriel Bianconi - 1 year ago 65
PHP Question

Fastest way to ping thousands of websites using PHP

I'm currently pinging URLs using CURL + PHP. But in my script, a request is sent, then it waits until the response comes, then another request, ... If each response takes ~3s to come, in order to ping 10k links it takes more than 8 hours!

Is there a way to send multiple requests at once, like some kind of multi-threading?

Thank you.

Answer Source

You can either fork your php process using pcntl_fork or look into curl's built-in multi-threading.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download