Finding all sequential images on a remote server with php

Post Reply
darknkreepy3#
Site Admin
Posts: 253
Joined: Tue Oct 27, 2009 9:33 pm

Finding all sequential images on a remote server with php

Post by darknkreepy3# »

If you saw a cool picture and knew that there were a few that followed a series, it would be easy to find them with a loop. There would be a lot of missing images if they weren't all in order, or some were removed. To circumvent this and load only existing images in a loop, you can use the slow CURL approach if the remote server allows you to peek at individual images, backgrounds, and you know the path.

Here is an example with naughty pics as a folder for some lame spam, hack, malware site, but the images are almost all illustrations and 3d. NSFW.

test.php on a server with CURL enabled, even your home server :) (it runs very slowly)

Code: Select all

<html>
	<body>
		<?php

			$root="http://223.cdn.beyondhosting.net/All/";
			$len=200;
			//
			for($t=0;$t<$len;$t++)
				{
				$n=$t;
				//
				if($t<10)
					{
					$n="0".$n;
					}
				$url=$root."$n.jpg";
				//echo "$url<br />";
				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL,$url);
				// don't download content
				curl_setopt($ch, CURLOPT_NOBODY, 1);
				curl_setopt($ch, CURLOPT_FAILONERROR, 1);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
				if(curl_exec($ch)!==FALSE)
					{
					echo "
						<img src='$url' width='200px' />";
					}
				curl_close($ch);
				}
		?>
	</body>
</html>
Post Reply