A Guide to Mobile and Web Technology(LAMP)

The following lines of code will provide search results using the google search API.

//search text to be passes
	$search_text = "katharnavas";
	$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=".$search_text;

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$results = curl_exec($ch);
	curl_close($ch);

	// The results will be in json encoded format so do a decode
	$json = json_decode($results);
	print_r($json);

Comments on: "Google Search text code using php" (1)

  1. Nice Post, btw do you know any good usenet archives and or mailing list archives site for unix / linux / bsd

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: