[GET][SCRIPT] Google Suggest Keyword Scraper

Status
Not open for further replies.

buzzcore

Junior Member
Joined
Apr 7, 2013
Messages
174
Reaction score
49
Hey guys,

I made this a while ago and have been using it to generate big lists of keywords based on Google search suggest. Here is an example of what it does...

skPJe6l


Will generate up to 6,760 keywords with this phrase in front of it like so...

Code:
[COLOR=#ffffff][FONT=arial][SIZE=2]how to write aaron in arabic
how to write aaron in chinese
how to write aaliyah in arabic
how to write aaron in japanese
how to write aahil in urdu
how to write ashirwad in hindi
how to write aaron in hebrew
how to write aa degree on resume
...
(6,000 more results here)
..
how to write zubair in arabic
how to write chi in chinese
how to write zuko in chinese
how to write zu in japanese keyboard
how to write on your zwinky profile
how to write your name on zwinky
how to write zx spectrum games
how to write a zx spectrum emulator
how to write zynga
how to write to zynga support
how to write email to zynga
how to write a complaint to zynga
how do you write to zynga
how to write a letter to zynga
how to write a message to zynga
how to write a prescription for zyban[/SIZE][/FONT][/COLOR]

The script is as follows, make it a php file and upload it to your server. One word of warning though, I'm sure if you spam this script a lot every day Google will ban your IP, so use it sparingly. I have used it once a day since I made it and I havn't been hit with an IP ban yet.

Code:
[COLOR=#ffff00]<?php
if (isset($_POST["keyword"]) && $_POST['keyword'] !== "") {    
$alphas1 = range('A', 'Z');    
$alphas2 = range('A', 'Z');    
$keyword = $_POST['keyword'];    
foreach ($alphas1 as $a1) {        foreach ($alphas2 as $a2) {            
$xml = simplexml_load_file("http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=$keyword.' '.$a1.$a2");            
foreach ($xml->children() as $child) {                               
foreach ($child->suggestion->attributes() as $dta) {                                        
echo "<br>";                    
echo $dta;                                   
 }            }                    }    }} else {?>
<form action="<?php    $_SERVER['PHP_SELF'];?>" method="post">Keyword: <input type="text" name="keyword"  required><input type="submit"></form>
<?php}?>[/COLOR]

Hope it is of some use to you all!:drinking2​
 
Do the suggestions change depending on the IP (location) of the search?
 
Why don't you add proxy support to this script?
 
I'm not sure to be honest. However you can modify it for any language you want by changing the "hl=en" to hl={required 639-1 language code} http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes.
Didn't know about that, thank you.
 
Why don't you add proxy support to this script?

I never added proxy support for this as I never needed it. It would be quite a task to make this utilize proxies but I may look into it.
 
Some formatting issues (copy/paste code to forum) giving error in line 14. Try this

Code:
<?php
if (isset($_POST["keyword"]) && $_POST['keyword'] !== "") {
$alphas1 = range('A', 'Z');
$alphas2 = range('A', 'Z');
$keyword = $_POST['keyword'];
foreach ($alphas1 as $a1) { foreach ($alphas2 as $a2) {
$xml = simplexml_load_file( utf8_encode("http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=$keyword.' '.$a1.$a2"));
foreach ($xml->children() as $child) {
foreach ($child->suggestion->attributes() as $dta) {
echo "<br>";
echo $dta;
}}}}
} else {
?>
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post">Keyword: <input type="text" name="keyword" required><input type="submit"></form>
<?php
}
?>


OP, you should check encoding, something with simplexml_load_file() is not ok, I have tried to push utf-8 with

$xml = simplexml_load_file( utf8_encode("http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=$keyword.' '.$a1.$a2"));

but still getting some error after results are printed. I am away of my working laptop now so can not test it further but just wanted to let you know. this is error

Code:
[B]Warning[/B]:  simplexml_load_file() [[URL="http://popupdevil.com/function.simplexml-load-file"]function.simplexml-load-file[/URL]]:   [URL]http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=story.'%20'.C.J:1:[/URL]  parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0x9A 0x61 0x76 0x61 in [B]/my domain here/GoogleSuggestKeywordScraper.php[/B] on line [B]7[/B]

[B]Warning[/B]:  simplexml_load_file() [[URL="http://popupdevil.com/function.simplexml-load-file"]function.simplexml-load-file[/URL]]: 7"/></CompleteSuggestion><CompleteSuggestion><suggestion data="story cjenik ogla in [B][B]/my domain here[/B]/GoogleSuggestKeywordScraper.php[/B] on line [B]7[/B]

[B]Warning[/B]:  simplexml_load_file() [[URL="http://popupdevil.com/function.simplexml-load-file"]function.simplexml-load-file[/URL]]:                                                                                ^ in [B]/my domain here/[/B][B]GoogleSuggestKeywordScraper.php[/B] on line [B]7[/B]

[B]Fatal error[/B]:  Call to a member function children() on a non-object in [B][B]/my domain here/[/B]GoogleSuggestKeywordScraper.php[/B] on line [B]8[/B]
 
Some formatting issues (copy/paste code to forum) giving error in line 14. Try this

Code:
<?php
if (isset($_POST["keyword"]) && $_POST['keyword'] !== "") {
$alphas1 = range('A', 'Z');
$alphas2 = range('A', 'Z');
$keyword = $_POST['keyword'];
foreach ($alphas1 as $a1) { foreach ($alphas2 as $a2) {
$xml = simplexml_load_file( utf8_encode("http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=$keyword.' '.$a1.$a2"));
foreach ($xml->children() as $child) {
foreach ($child->suggestion->attributes() as $dta) {
echo "<br>";
echo $dta;
}}}}
} else {
?>
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post">Keyword: <input type="text" name="keyword" required><input type="submit"></form>
<?php
}
?>


OP, you should check encoding, something with simplexml_load_file() is not ok, I have tried to push utf-8 with

$xml = simplexml_load_file( utf8_encode("http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=$keyword.' '.$a1.$a2"));

but still getting some error after results are printed. I am away of my working laptop now so can not test it further but just wanted to let you know. this is error

Code:
[B]Warning[/B]:  simplexml_load_file() [[URL="http://popupdevil.com/function.simplexml-load-file"]function.simplexml-load-file[/URL]]:   [URL]http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=story.'%20'.C.J:1:[/URL]  parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0x9A 0x61 0x76 0x61 in [B]/my domain here/GoogleSuggestKeywordScraper.php[/B] on line [B]7[/B]

[B]Warning[/B]:  simplexml_load_file() [[URL="http://popupdevil.com/function.simplexml-load-file"]function.simplexml-load-file[/URL]]: 7"/></CompleteSuggestion><CompleteSuggestion><suggestion data="story cjenik ogla in [B][B]/my domain here[/B]/GoogleSuggestKeywordScraper.php[/B] on line [B]7[/B]

[B]Warning[/B]:  simplexml_load_file() [[URL="http://popupdevil.com/function.simplexml-load-file"]function.simplexml-load-file[/URL]]:                                                                                ^ in [B]/my domain here/[/B][B]GoogleSuggestKeywordScraper.php[/B] on line [B]7[/B]

[B]Fatal error[/B]:  Call to a member function children() on a non-object in [B][B]/my domain here/[/B]GoogleSuggestKeywordScraper.php[/B] on line [B]8[/B]


Hi, yes simplexml_load_file can only parse utf-8. It seems that when the script for your search query "story" gets to "story cj" one of the results contains a non utf-8 character, and this is why it is giving this error. I will look into it when I have some free time.
 
buzzcore,

Thank you a lot for this tool bro, that looks really cool.
 
Last edited:
I've opened a "Hire a Freelancer" project regarding to this post. I need a little customization. All are welcomed to it..

It is: [h=2]"$20 For Quick Customization of "Google Suggest Keyword Scraper"[/h]
in the "Hire a Freelancer" section.
 
I wanted to post the job here as well:

Hi,


buzzcore, has made a great "google suggestions scraper" here: "search the forum for:"[GET][SCRIPT] Google Suggest Keyword Scraper"


Thanks a lot again for what he has done and for sharing it here publicly. The code is shared in the post, too.

What I need is: the shared script works for scraping suggestions in the "keyword + anyword" format, I mean it scrapes the search suggestions that are added afterthe entered keyword.

I need a small change in the script and a small selection feature like "before keyword" or "after keyword" so that the script can do the same job for scraping suggestions in the "anyword + keyword" format. So it basically needs words creation engine before the keyword, as well. And the words can be more than 1.

I need to do that because I want to scrape "..... .... treatment" keywords from google. Such keywords like:

"asthma treatment"
...
...
"herpes treatment"
"hemorrhoids treatment"
...
"knee pain treatment"
...
...
"stress treatment"
...
etc..

I'll pay $20 for it. And I'll share it here in the bhw just like buzzcore so that everyone can benefit it.

buzzcore himself is also welcomed to make the changes since it's his script he can do it faster than anybody I guess.

The freelancer should make a scrape after the job and prove that it works.

Please feel free to ask any questions if you don't understand anything.

Thanks for reading.
 
I wanted to post the job here as well:

Hi,


buzzcore, has made a great "google suggestions scraper" here: "search the forum for:"[GET][SCRIPT] Google Suggest Keyword Scraper"


Thanks a lot again for what he has done and for sharing it here publicly. The code is shared in the post, too.

What I need is: the shared script works for scraping suggestions in the "keyword + anyword" format, I mean it scrapes the search suggestions that are added afterthe entered keyword.

I need a small change in the script and a small selection feature like "before keyword" or "after keyword" so that the script can do the same job for scraping suggestions in the "anyword + keyword" format. So it basically needs words creation engine before the keyword, as well. And the words can be more than 1.

I need to do that because I want to scrape "..... .... treatment" keywords from google. Such keywords like:

"asthma treatment"
...
...
"herpes treatment"
"hemorrhoids treatment"
...
"knee pain treatment"
...
...
"stress treatment"
...
etc..

I'll pay $20 for it. And I'll share it here in the bhw just like buzzcore so that everyone can benefit it.

buzzcore himself is also welcomed to make the changes since it's his script he can do it faster than anybody I guess.

The freelancer should make a scrape after the job and prove that it works.

Please feel free to ask any questions if you don't understand anything.

Thanks for reading.

Unless someone can correct me I don't think this is possible. The tool works by taking your keyword, in your case "treatment" then appends 2 letters the the end of it by double iterating the alphabet. so it will ask google for suggestions on "treatment aa" then "treatment ab", "treatment ac"... through to "treatment zz".

But, appending these letters to the start of the query will work. Asking google for suggestions on "kn treatment" will not bring up "knee treatment".

There are programs that can help you, but they will cost you more than $20 no doubt. Wish I could help you out.

All the best in your campaign!
Buzz
 
Hi buzzcore,

Thanks for your reply.

What programs do you mean exactly?
 
I know this is a very old thread so I hope there is someone that can still help me out... When I add this script to my page something is breaking, so after printing the results it does not display anything else on the page the footer etc. Can anyone tell me why?

EDIT:
It must have been timing out with Google or something, I have no idea. I took out the loops and alphas ranges so that it would just give the suggestions for the keyword only and now everything works (my footer and everything below is showing properly now).

Is there any way to fix this or can I somehow set a limit to the number of results?

Thanks!
 
Last edited:
Status
Not open for further replies.
Back
Top