get searching data from google on localhost

Hi friends,
Try this to get search data on your local host.

$text = $_POST['search'];


<form action="searchbygoogle.php" method="POST">
<input name="search" type="text" value="<?= $text;?>" />
<input type="submit" value="Search" />

if ($_POST['search']==""){
echo "No search data found";
$query = file_get_contents("".urlencode($_POST['search'])."&hl=en&ie=UTF-8&filter=2");

//needs to be added with more queries
$replace_array = array('/\n/','/(.*)<\/head>/','/(.*)
//pregraplacing unneeded parts
$results = preg_replace($replace_array, '', $query);
echo $results;



Popular posts from this blog

How to fix 500 internal privoxy error

ubuntu package installation

jQuery & JavaScript PDF Viewer plugin