Home >Backend Development >PHP Tutorial >PHP gets domain name indexed by google

PHP gets domain name indexed by google

WBOY
WBOYOriginal
2016-07-25 09:09:471005browse

  1. function get_index($domain){
  2. $index=array();
  3. $url="http://www.google.com/search?source=hp&biw=1440&bih=762&q=site%3A$domain&aq=f&aqi=g10&aql=&oq=";
  4. $html=file_get_contents($url);
  5. preg_match('/
    [Ss].*/Ui', $html,$index);
  6. for($i=0;$i<=strlen($index['0']);$i++){
  7. if(is_numeric($index['0'][$i])){
  8. $count.=$index['0'][$i];
  9. }
  10. }
  11. return $count;
  12. }
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:DBO Form WidgetNext article:DBO Form Widget