extract src image website

<?php
$data = file_get_contents("http://www.ip-adress.com/ip_tracer/202.43.100.27");
$pattern = "/src=[\"']?([^\"']?.*(png|jpg|gif))[\"']?/i";
preg_match_all($pattern, $data, $images);
foreach($images as $imgs){
 foreach($imgs as $img){
 echo $img . "<br />";
 }
}
?>

hasil yg didapat adalah array matrik 2 dengan 3 array turunan

contoh:

array [0][n] = src=”/i/ip_barcode.gif”

array[1][n]=/i/ip_barcode.gif

array[2][n]=gif

Published by

G3n1k

just to remember what i had known :)

Leave a Reply

Fill in your details below or click an icon to log in:

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