Curl is good for getting remote data and making dynamic requests.
<form method="post"><input type="text" name="search" value="india"><input type="submit" value="Search"></form>
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
$result_cnt=2;
$search=$_REQUEST['search']?$_REQUEST['search']:"";
$url="http://www.google.co.in/search?num=$result_cnt&hl=en&safe=off&q={$search}";
curl_setopt($ch, CURLOPT_URL, $url);
//Becoz we dont want to show result by default
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
$data=curl_exec($ch);
$data_arr=explode("<ol>",$data);
$data=explode("</ol>",$data_arr[1]);
print_r($data[0]);
?>