php - Checking 1000 urls if they exist or not, is there a quick way for this? -
I have an array of URLs (~ 1000 URLs in it), I want to see them all if they exist or No . Here's my current code:
$ south_east_png_endings = array (); ($ Y = 1; $ y & lt; = 48; $ y ++) {$ south_east_png_endings [] = "$ {$ x = 1; $ x This script works, it removes all the action URLs, but this process is very long (it takes several minutes to complete). Is there a way to speed it up or is it as fast as it is happening? Maybe I can use the curl_timeout functions to reduce the time?
1) get_headers () actually receives the request, which is not necessary if you want to know Use a head instead of whether a file exists or not:
& lt ;? Php // uses a GET request to get the get_headers header by default if you want to send // a HEAD request instead, you can do this by using a stream reference: stream_context_set_default (' Http '= & gt; array (' method '= & gt;' HEAD '))); $ Header = get_headers ('http://example.com'); ? & Gt; 2) Since these checks can easily run in parallel, you should use different threads / processes to check. However, if you are doing it from home, then your router can suppress 1000 requests once, so you would like to use something like 5-20 concurrent threads.
Comments
Post a Comment