PHP Classes

File: GoogleSearchExample

Recommend this page to a friend!
  Classes of Jose Johnson Pallikkathyil   Google Domain Search Result Integration   GoogleSearchExample   Download  
File: GoogleSearchExample
Role: Example script
Content type: text/plain
Description: Google Search Example file which uses the google search class
Class: Google Domain Search Result Integration
Search a site and retrieve results from Google
Author: By
Last change:
Date: 14 years ago
Size: 2,174 bytes
 

Contents

Class file image Download
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

<?php
//SAMPLE USAGE OF THIS CLASS



//startSearch( keyword,searchOnlyCurrentDomain,headStyle,descriptionStyle,siteURLStyle,pagingLink,NeedtoHiglightSearchTerm)

//sample styles
echo("<style>
.linkgoogle:hover {color:blue;font-weight:bold;text-decoration: none;}
.linkgoogle {color:red;font-weight:bold;text-decoration: none;}
.txt{color:#000000;font-family:Arial, Helvetica, sans-serif;font-size:13px}
.cite{color:#009900;font-family:Arial, Helvetica, sans-serif;font-size:13px;font-style:italic}
.cite:hover{color:red;font-family:Arial, Helvetica, sans-serif;font-size:13px;font-style:bold}
.head{color:#669933;font-family:Arial, Helvetica, sans-serif;font-size:16px}
.pagelink:hover {color:red;text-decoration: none;font-size:11px;font-family:arial;font-weight:bold}
.pagelink {color:black;font-size:11px;font-family:arial;text-decoration: none;font-weight:bold}
</style>"
);

//uncomment below include stmt when calling the class from other page
include_once("google-search.class.php");

//set domain for searching [option]
//if search domain is not given, the application take the running server address "www.yourserver.com"
$searchDomain="www.yourdomainname.com";

//create object for the search class
$obj= new googlesearch($searchDomain);

$searchTerm=""; //default keyword optional

if( isset($_GET['ser']) ){
if(
$_GET['ser'] != "" )
$searchTerm=$_GET['ser'];
}

//interface
echo("<table><tr><td>Google Search</td></tr><tr><td><form method=\"get\" action=\"\"><input type=\"text\" name=ser value=\"");
echo((isset(
$searchTerm))?$searchTerm:"");
echo(
"\" /> <input type=\"submit\" name=btn value=\"Search\"/></form></td></tr><tr><td>");
$obj->startSearch($searchTerm,1,"linkgoogle","txt","cite","pagelink",1);
echo(
"</td></tr></table>");

?>

</body>
</html>