I need to show a big image that was searched by google throu simple_html_dom.php
include_once( "simple_html_dom.php" );
$key="alexis";
$html = new simple_html_dom();
$html=file_get_html('http://images.google.com/images?as_q='. $key .'&hl=en&imgtbs=z&btnG=Search+Images&as_epq=&as_oq=&as_eq=&imgtype=&imgsz=m&imgw=&imgh=&imgar=&as_filetype=&imgc=&as_sitesearch=&as_rights=&safe=images&as_st=y');
foreach($html->find('a') as $element) {
preg_match('#(?:http://)?(http(s?)://([^\s]*)\.(jpg|gif|png))#', $element->href, $imagelink);
echo $imagelink['1'];
}
Results:
But i need a link just for the first one image , thanks
1 Answer