Need simple script - For Google results check

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
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
•••
Tnx a lot ;)
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back