Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:54:44+00:00 2026-06-13T14:54:44+00:00

Currently, you can import a spreadsheet (contains a list of websites) into a database.

  • 0

Currently, you can import a spreadsheet (contains a list of websites) into a database. You are able to click a button and it retrieves the number of pages that Google has indexed for each domain in the database.

It works fine up until about ~400 requests and then my requests come back with nothing. Not sure what I am doing incorrectly or how to make this work – any ideas?

try {
        require('db.php');
        $conn = new PDO ( "mysql:host=localhost;dbname=" . $database, $user, $pass );
        $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
        $stmt = $conn->query('SELECT `url` FROM domains');
        $stmt->setFetchMode(PDO::FETCH_ASSOC);
        while($row = $stmt->fetch()){
            $id = $row['id'];
            $url = $row['url'];
            $pages = getIndexedPageCount($url);
            if ( $pages > 0 ) {
                $status = 1;
            } else {
                $status = 0;
            }
            $prep = $conn->prepare("
            UPDATE `domains`
                SET
                    url = :url,
                    pages = :pages,
                    status = :status
                WHERE url = :url
            ");
            $prep->execute(array(
                ':url'      =>  $url,
                ':pages'    =>  $pages,
                ':status'   =>  $status
            ));
        }
    } catch ( PDOException $e ) {
        echo 'Error: ' . $e->getMessage();
        exit;
    }


    function getIndexedPageCount($domain) {

    // remove http:// and https://
    if ( strpos( $domain, 'http:' ) == 0 ) { $domain = str_replace('http://', '', $domain); }
    if ( strpos( $domain, 'https:' ) == 0 ) { $domain = str_replace('https://', '', $domain); }

        $content = file_get_contents('https://www.googleapis.com/customsearch/v1?key={{Removed API Key}}&q=site:' . $domain);

        if (strlen($content) > 1) {
            $data = json_decode($content);
            return intval($data->searchInformation->totalResults);
        }

        else {
            echo "Error: URL does not exist.";
        }
    }

Any help would be greatly appreciated; if anyone has an idea I’ll try and make it work!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:54:45+00:00Added an answer on June 13, 2026 at 2:54 pm

    There is a limit to the number of requests you can send to Google.

    See here for details https://developers.google.com/console/help/#monitoringandfiltering

    Here is the API console: https://code.google.com/apis/console

    In the console currently it says for Custom Search API there is a Courtesy limit: 100 requests/day

    Any usage beyond the free usage quota will fail if you are not signed up for billing. Once you have enabled billing, you will continue to receive 100 free queries per day. However, you will be billed for all additional requests at the rate of $5 per 1000 queries, for up to 10,000 queries per day.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a large number of CSVs to import to a MySQL database.
I'm trying to import a spreadsheet to our database using SSIS. For some reason
I've got to write a horrible interface to import data into a new database
Can you import and commit multiple PIM contacts collectively? Currently we are importing and
We currently have to import around 200 students into our active directory. We have
How can I get a variable that contains the currently executing function in Python?
import numpy a = numpy.array([20090913, 20101020, 20110125]) Can you explain why numpy.datetime64(a.astype(S8).tolist()) converts correctly
Currently I can set ringtones and notifications with: byte[] buffer = null; InputStream fIn
I can currently use sgml-pretty-print to pretty print an xml file in emacs, but
I can currently convert a virtual directory to an application via the iis7.0 managers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.