Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Need simple script - For Google results check

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

andrejc

Established Member
Impact
12
I need script that will return number of google results for multiple keywords entered. If anyone already has this kind of script or knows how to code one, please PM me.


Tnx
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Just knocked this up for you, using a simple preg_match to grab the results from google.

PHP:
<?php

if( strlen($_POST['submit']) > 0 )
{
	$google_root = 'google.com';
	
	$keywords = str_replace(' ', '+', stripslashes($_POST['query']));
	$buffer = file_get_contents('http://' . $google_root . '/search?hl=en&q=' . $keywords);
	
	if( preg_match("/Results <b>[0-9]+<\/b> - <b>[0-9]+<\/b> of about <b>([^\.]+)<\/b> for/i", $buffer, $matches) )
	{
		echo "There were {$matches[1]} results found for " . str_replace('+', ' ', '"' . $keywords . '"');
	}
	else
	{
		echo 'No results were found';
	}
}
else
{
	?>
	<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
	Keywords: <input type="text" name="query" value="" /><br />
	<input type="submit" name="submit" value="Submit" />
	</form>
	<?php
}
?>

Working example: http://mattjewell.com/google.php
 
Last edited:
0
Close
Tnx a lot ;)
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back