<?php
/* return result number */
function get_google_results($domain = 'vijayjoshi.org')
{
// get the result content
$content = file_get_contents('http://www.google.com/search?q=site:'.$domain);
// parse to get results
$result = get_match('/Results <b>(.*)from/isU',$content);
// echo $result;
// split the results
$split1 = explode('of about',$result);
// return result
return $split1[1] ? strip_tags($split1[1]) : 0;
}
/* helper: does the regex */
function get_match($regex,$content)
{
preg_match($regex,$content,$matches);
return $matches[1];
}
/* do it! */
echo 'vijayjoshi.org: '.get_google_results('vijayjoshi.org'); // 164
//echo 'Philogy.com: '.get_google_results('philogy.com'); // 164
?>
Secure file download in PHP, Security question PHP, PHP MYSQL Interview Question -Books download - PHP solutions guidelines queries update, phpmysqlquestion
Subscribe to:
Post Comments (Atom)
How to solve mysql ERROR 1118 (42000) Row size too large
I had this issue with MYSQL 5.7 . The following worked althoug...
-
PHP has an SSH2 library which provides access to resources (shell, remote exec, tunneling, file transfer) on a remote ma...
-
Which pillar of the AWS Well-Architected Framework recommends maintaining infrastructure as code? Operational Excellence Which of the foll...
-
Introduction to PHP PDO (PHP Data Objects) 1. What is PDO 2. What Databases does PDO support 3. Where do I begin? 4. Connect to ...
No comments:
Post a Comment