<?php } else { ?> <body border="0" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" bgcolor="#000000" link="#000000" alink="#000000" vlink="#000000"> <div style="text-align: center; width:100%; height:100%; overflow: hidden"> <div style="width: 1260px; height: 100%"> <?php if (!isset($_GET['start'])) { $_GET['start'] = 0; } if (!isset($_GET['type'])) { $_GET['type'] = 'video'; } $gs = new GoogleSearch(); $searchtype = $_GET['type'] == 'video' ? GoogleSearch::VIDEO : GoogleSearch::IMAGE; $result = $gs->search($_GET['q'], $searchtype, 54, $_GET['start']); $i = 0; foreach ($result[$_GET['type']] as $image) { $i++; if (isset($_GET['type']) && $_GET['type'] == 'image') { echo '<a href="' . $image->originalContextUrl . '" target="_blank">'; echo '<img src="showthumb.php?image=' . rawurlencode($image->tbUrl) . '" border="0" title="[' . $image->titleNoFormatting . "] - " . $image->content . '"/>'; } else { echo '<a href="' . $image->playUrl . '" target="_blank">'; echo '<img src="showthumb.php?image=' . rawurlencode($image->tbUrl) . '" border="0" title="[' . $image->titleNoFormatting . "] - " . $image->content . " [Runtime: " . $image->duration . ' seconds]"/>'; } echo '</a>'; if ($i % 9 == 0) { echo '<br/>'; } }
<pre><?php if (!isset($_GET['start'])) { $_GET['start'] = 0; } $gs = new GoogleSearch(); $result = $gs->search($_GET['q'], GoogleSearch::IMAGE, 54, $_GET['start']); $i = 0; print_r($result); ?> <?php class GoogleSearch { /**************************** * GoogleSearch::search() * * @author Viper-7 (viper7@viper-7.com) * @date 2009-7-12 * * @param search String to search for * @param numresults Number of results to return per search type (max 4) * @param searchType Types to search for, can be a combination of several ie SEARCH_WEB | SEARCH_VIDEO | SEARCH_IMAGE * * @return Array of result objects * ****************************/ const WEB = 1; const LOCAL = 2; const VIDEO = 4; const IMAGE = 8; const BLOG = 16;