I am trying to write a script that will loop through a set of URLs. Each URL points directly to a jpeg file. The images are not on the same server. I found this question but I can't use the CURL libraries (not active on my server) and when I use @getimagesize I found that my function returned false for all images; however, I worked out that the cause as follows: if I type the valid URL into a web browser, I am prompted to authenticate against the remote server. If I type an invalid URL against the remote server, then I receive 404 instead.
So my question becomes - given a remote URL, can PHP detect whether the remote server is prompting for login? If so, that would surely be faster than parsing the results of the valid and authenticated URL calls. If not, then how can I have the PHP script authenticate itself in order to check the remote image?