พอดีเขียนไว้ใช้ในโปรเจคต์ใหม่น่ะครับ เผื่อมีประโยชน์กับท่านอื่นบ้าง
คิดซะว่ามันคือดาบสองคมผุๆ จะเอาไปตีให้คมแล้วใช้ทำอะไร ก็แล้วแต่ความชอบของแต่ละคนครับ
ตัวอย่างที่ทำไว้ตามลิงก์นี้
http://www.xn--12cl1cba6b0a4byc6bzbd1lrefe.com/show.php 
Source Code
<?php
/*
อ่านหน่อย - สคริปต์นี้เขียนลวกๆขึ้นใช้เฉพาะกิจในโปรเจคต์ส่วนตัว ไม่รับประกันว่าจะใช้ได้ตลอดในอนาคต ถ้า google เปลี่ยนรูปแบบ image search ก็จบเห่กันพอดี
ด้วยความที่แจกฟรี ไม่ขาย เลยไม่ขอรับประกันใดๆทั้งสิ้น ขอให้โชคดี อีเมล์, MSN : [email protected]
*/
$keyword="doraemon";
$img_w="1024";
$img_h="768";
$pstart="18";
//$target = getUrlContents('http://www.google.com/images?q='.$keyword.'&um=1&ie=UTF-8&source=og&sa=N&hl=th&tab=wi&biw=1366&bih=653');
$target = getUrlContents('http://www.google.com/images?hl=en&&um=1&ie=UTF-8&source=og&sa=N&q='.$keyword.'&safe=on&tbs=isch:1,isz:ex,iszw:'.$img_w.',iszh:'.$img_h.'&sout=1&biw='.$img_w.'&bih='.$img_h.'&start='.$pstart);
///////////////////////
function getUrlContents($url, $maximumRedirections = null, $currentRedirection = 0)
{
$result = false;
$contents = @file_get_contents($url);
if (isset($contents) && is_string($contents))
{
preg_match_all('/<[\s]*meta[\s]*http-equiv="?REFRESH"?' . '[\s]*content="?[0-9]*;[\s]*URL[\s]*=[\s]*([^>"]*)"?' . '[\s]*[\/]?[\s]*>/si', $contents, $match);
if (isset($match) && is_array($match) && count($match) == 2 && count($match[1]) == 1)
{
if (!isset($maximumRedirections) || $currentRedirection < $maximumRedirections)
{
return getUrlContents($match[1][0], $maximumRedirections, ++$currentRedirection);
}
$result = false;
}
else
{
$result = $contents;
}
}
return $contents;
}
class ExtractTextBetweenTags
{
function extract($string,$ot,$ct)
{
$string = trim($string);
$start = intval(strpos($string,$ot) + strlen($ot));
$mytext = substr($string,$start,intval(strpos($string,$ct) - $start));
return $mytext;
}
}
////////////////////////////////////////////
$extDetail = new ExtractTextBetweenTags();
$pData = $extDetail->extract($target,'<div id=ImgCont>','</div><div id=ncm>');
$pData = strip_tags($pData, '<img>');
$pDatab = $extDetail->extract($target,'<div id=ImgCont>','</div><div id=ncm>');
$pDatab = strip_tags($pDatab, '<table><tr><td>');
$splitterb = explode('×',$pDatab);
$splitter = explode('<img src=',$pData);
if($splitter[1]){
for($i=1; $i<=18; $i++) {
$splitterx = explode('<td align=left valign=top width=23% >',$splitterb[$i]);
$spliturl = explode('http://',$splitter[$i]);
$splitref = explode(' width=',$spliturl[2]);
$splitref[0];
$splitterb = explode(':http://',$splitter[$i]);
if($splitterb[0]){?>
<a href="http://<?=$splitref[0]?>" target="_blank"><img src='<?=$splitterb[0]?>' /></a>
<?
}
}
}
?>