I'm looking to ping a lot of URL's without caring about the output, what I care about is performance, I want to know what is the best way of doing so
Asked
Active
Viewed 286 times
-1
-
What do you mean by "ping"? Are you actually trying to ping a host? Or request the headers of a resource at a particular URL? – Brad Aug 14 '12 at 16:50
-
`without caring about the output` - surely you must care about *something* to do with the output? Surely you must want to know whether packets are returned? Or are you trying to implement a ping-of-death, because I doubt you'll find anyone here who'll help you with that. Well, I hope not, anyway. – DaveRandom Aug 14 '12 at 16:51
-
Are you so specific to use `php`? Coz there are load testing tools which will suits this requirement. http://learnloadrunner.com/ – sundar Aug 14 '12 at 16:51
-
Well if what you want to do is get the headers for many URLs at the same time, [`curl_multi_exec()`](http://php.net/manual/en/function.curl-multi-exec.php) is what you are looking for. But I agree with @sundar that PHP is not the best language for this, Node.js springs immediately to mind as being very easy to implement this sort of thing with. – DaveRandom Aug 14 '12 at 16:51
-
@DaveRandom no I'm really not caring about the output, I just want to execute the URL until it finish executing – Sanjana Thakur Aug 14 '12 at 16:53
-
can curl_milti_exec() execute a URL till it's death? – Sanjana Thakur Aug 14 '12 at 16:54
-
Until its death? Are you planning to kill websites? – Tchoupi Aug 14 '12 at 16:55
-
@sundar I'm specific to PHP, also I never used node.js and don't know how to run it – Sanjana Thakur Aug 14 '12 at 16:56
-
@SanjanaThakur `curl_multi_exec()` executes a set of cURL handles all at the same time. By `till it's death` I presume you mean "until the HTTP transaction is complete", in which case the answer is "Yes" (that's sort of the point of it). – DaveRandom Aug 14 '12 at 16:56
-
@MathieuImbert nope :D what I meant it the execution of the script must finish – Sanjana Thakur Aug 14 '12 at 16:57
-
Take a look at [this](http://stackoverflow.com/questions/1155512/using-php-to-ping-a-website) and [this](http://stackoverflow.com/questions/1239068/ping-site-and-return-result-in-php) answers. – The Alpha Aug 14 '12 at 17:01
-
@DaveRandom thanks this will do the job I guess :) – Sanjana Thakur Aug 14 '12 at 17:04
1 Answers
0
HTTP HEAD request is probably what you are looking for. It will return you full information about particular URL (status code, size, etc ...) but without transferring its contents. This request can be made with any 'low-level' TCP functions like PHP's fsockopen and CURL extension, shell's telnet and similar.

mikikg
- 1,488
- 1
- 11
- 23