Images Indexed In Search Engines

Hello all!

Is it possible to create a script that checks and displays how many images are indexed for a list of URLs (domains)?

So if I had a list like:


The script would check both "Yahoo image search" and "Google image search" and return how many images each domain has indexed - like:

url1= 12 Yahoo 10 Google
url2= 2 Yahoo 5 Google
url3= 15 Yahoo 12 Google

Is this at all possible??

Thank you~!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

function get_google_search_count ($q) {
  $s = file_get_contents('' . urlencode($q));
  $b = preg_match ('|Results <b>1</b> - <b>\d+</b> of(?: about)? <b>([\d,]+)</b>|', $s, $a);
  return $b ? intval(str_replace(',', '', $a[1])) : 0;

echo get_google_search_count('Radiation'); // outputs 266000
To get the count for a specific site, use

echo get_google_search_count(''); // outputs 103
function get_image_search_count ($q, $engine) {
$engine_url = Array(
  'google' => '',
  'yahoo' => '',
  'msn' => ''
$engine_regex = Array (
  'google' => '#Results <b>1</b> - <b>\d+</b> of(?: about)? <b>([\d,]+)</b>#',
  'yahoo' => '#Results <strong>1 - \d+</strong> of about <strong>([\d,]+)</strong>#',
  'msn' => '#<h5>Page 1 of ([\d,]+) results containing#'
  $e = strtolower($engine);
  $s = file_get_contents( $engine_url[$e] . urlencode($q) );
  $b = preg_match ($engine_regex[$e], $s, $a);
  return $b ? intval(str_replace(',', '', $a[1])) : 0;

echo get_image_search_count('Hello world!', 'Yahoo') . '<br />';  // 73331
echo get_image_search_count('Hello world!', 'Google') . '<br />'; // 73800
echo get_image_search_count('Hello world!', 'MSN') . '<br />';    // 2176
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

laura_skyAuthor Commented:
Thanks KennyTM . . .

If I wanted to use a textarea box to enter a list of URLs, how would I do this?


<form action="index.php>
<input type="submit" value="Check">

Is there a way to do this, so that it checks each URL from the list?

The problem is that Yahoo! will not search anything if you enter only the domain alone. (e.g., in , enter some URL in "only search in this domain/site:" and leave all other things blank, then press "Yahoo! Search"... you'd end up being in the homepage of image search.)
laura_skyAuthor Commented:
I see what you're saying...

In that case, how about using GET, and appending the domain to the end of:

Which returns 70 results...

If this still won't work, is there a way to just check Google image search?

Also, is it possible to check a list of URLs enetered into a textarea field?

If you just want to check the Google image search, just write

get_image_search_count('', 'Google');


For your suggestion, it can actually be implemented with

get_image_search_count('', 'Yahoo');

However, as you can see from the result, not everything is really related by For example, the first image "headleft.jpg" has absolutely nothing to do with (although the URL has the string ""). If this is what you want, just use the code above. Otherwise, I can't help with Yahoo!.
laura_skyAuthor Commented:
Ok, I see...

But how would I check a list of URLs at the same time without entering them each individually?


get_image_search_count('', 'Google');

I would have to type in the URL for each site, which would be very time consuming, and would defeat the purpose of creating a script in the first place. :-)

So can a textarea field be used?

sure. Suppose $a holds the content of the textarea. Then you explode() the string by

$urls = explode("\r\n", $a);

Then call get_image_search_count() for every URL:

$counts = Array();
foreach ($urls as $k => $url) {
  $counts[$k] = get_image_search_count("site:$url", 'Google');
print_r ($counts);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
laura_skyAuthor Commented:
I'm sorry, I've been so busy recently that I totally forgot about this question!

I have not abandoned this question. In fact, I still require help with this question, that is if KennyTM still wants to assist me?

If not, I will gladly close this question and award KennyTM 400 points.

Please let me know!

Thanks again!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.