I was gonna release this when it was complete but what the hey if anyone ccan find the error that is stoppingg tthis code from working please reply
<?php
function searchgoogle($searchkeywords, $getincrement){
$searchquery = str_replace(" ","+",$searchkeywords);
$searchurl = "http://www.google.co.uk/search?q=";
$finalquery = ($searchurl.$searchquery);
$startdata = file ($finalquery);
$buf=implode ('', $startdata);
$contentstart=strpos($buf, "<font size=-1 color=>Results <b>");
if ($contentstart === false) {
echo "not found";
exit; }
$contentend=strpos($buf, "<td valign=bottom nowrap><font size=-1>Result");
$contentlength=$contentend-$contentstart;
$realcontent=substr($buf,$contentstart,$contentlength);
//new part of function
$numstart=strpos($buf, "</b> of about <b>");
if ($numstart === false) {
echo "not found";
}
$websitesearchurl = "http://localhost/googlesearch.php?keywords=";
$thissearch = $websitesearchurl.$searchquery;
$numend=strpos($buf, "</b> for <b><b>" );
$numlength=$numend - $numstart;
$realnum=substr($buf,$numstart,$numlength);
$realnumb=str_replace("</b> of about <b>","",$realnum);
$realnumter=str_replace(",","",$realnumb);
$increments = $realnumter / "10";
$currentincrement = $increment - $getincrement;
$nextincrement = "&start=".$currentincrement + "10";
$previncrement = "&start=".$currentincrement - "10";
$prev = "<a href=\"".$thissearch.$previncrement."\"><<Prev</a>";
$next = "<a href=\"".$thissearch.$nextincrement."\">Next>></a>";
if $getincrement == "0" {
echo $realcontent;
echo $next;
exit;
}
if $getincrement == $increments {
echo $realcontent;
echo $prev;
exit;
}
else{
echo $realcontent;
echo $prev$next;
exit;
}
//continue old shite
if (!isset($POST['keywords']){
$keyw = ($HTTP_GET_VARS['keywords']);
$curinc = ($HTTP_GET_VARS['start']);
searchgoogle($keyw, $curinc);
exit;
}
$keyw = ($POST['keywords']);
$curinc = ($HTTP_GET_VARS['start']);
searchgoogle($keyw, $curinc);
?>
this code is purely for educational purposes and google does not endorse it i think it could be the if statements thanx and enjoy the googlesearch function with example test code