I need a script that will run as a cron-job to collect the top 100 searches for any given day from the site [url removed, login to view] then search google for each of these terms and get the keywords of all the sites on the first 2 pages of search results. All the keywords including the search terms must be put in a database and I also need the number of search results for each keyword and search term from [url removed, login to view], [url removed, login to view], [url removed, login to view] and [url removed, login to view]
The terms from [url removed, login to view] should be in a separate table from the keywords and these should be linked together via ID. The terms should include the first and last date this keyword was retrieved from the trends pages and how many times this term has been in the top 100 trends.
The keywords file should be linked to the search term by ID and should contain the keyword and a list of the 100 results from [url removed, login to view] for that keyword with the adult filter set to "Remove offensive". These results should be linked to the keyword and the combination of keyword and suggested keyword should be unique.
A separate table should contain the following information... Search term / keyword,Year,Month,number of times found in this month,highest value value for number of results for this term in the 4 search engines mentioned above.
Neither terms or keywords are allowed to be duplicated.
Suggested Keywords fetched from [url removed, login to view] should be appended and linked to the keyword and once again, no duplicates are allowed for the combination of keyword and suggested keyword.