I am writing a script to download images periodically from other servers. And trying to make it so that if a server is laggy on sending the image back it'll stop and move on. I tried to use socket_set_timeout with fopen but am not having any luck -- no error, but no timeout either.
So is there anyway if the file takes longer than x seconds to download it will just abort and move on to the next image?
Thanks,
A A R O N
Snippet:
$url="http://servername.net/image.jpg";
$fd = fopen($url, "r");
socket_set_timeout($fd,5);
$contents = fread($fd, 100000);
$a = fopen("img.orig.jpg", "a");
fputs($a, $contents);