Share Coding

Tutorials, Problems, Stuffs …

Script of getting all the pictures’ URL of Photobucket’s album in PHP

http://s283.photobucket.com/albums/kk285/konnarak_1608/romantic/
Using above album for example.

Click here for Demo

<?php
$url = 'http://s283.photobucket.com/albums/kk285/konnarak_1608/romantic/';
$str = file_get_contents($url);
preg_match_all('/<img[^>]+>/i',$str, $result); 

foreach( $result as $img_tag) {
	foreach( $img_tag as $img) {
		if( !strpos($img, 'class="under off"') ) continue;
		preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $img, $imgURLs);
		$imgURL = str_replace("/th_", "/", $imgURLs[1]);
		echo $imgURL . "<br />";
	}
}
?>
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: