0

我正在使用以下脚本:

<?php

$domain_name = 'davidwinstead.com';
$domain_name = strtolower(trim($domain_name));

$yahoo_url = 'http://siteexplorer.search.yahoo.com/search?p=http%3A%2F%2F'.$domain_name;

$yahoo_url_contents = get_yahoo_contents($yahoo_url);

if(preg_match('/Pages \(([0-9,]{1,})\)/im', $yahoo_url_contents, $regs)){
    $indexed_pages = trim($regs[1]);
    echo ucwords($domain_name).' Has <u>'.$indexed_pages.'</u> Pages Indexed @ Yahoo.com';
}else{
    echo ucwords($domain_name).' Has Not Been Indexed @ Yahoo.com!';
}

function get_yahoo_contents($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}

?>

但似乎不起作用

有人有任何工作脚本吗?谢谢

4

1 回答 1

-1
<?php 
$domain_name = 'davidwinstead.com';
$domain_name = strtolower(trim($domain_name));
$yahoo_url = 'http://siteexplorer.search.yahoo.com/search?p=http%3A%2F%2F'.$domain_name;
$yahoo_url_contents = file_get_contents($yahoo_url);
if(preg_match('/Pages \(([0-9,]{1,})\)/im', $yahoo_url_contents, $regs)){
    $indexed_pages = trim($regs[1]);
    echo ucwords($domain_name).' Has <u>'.$indexed_pages.'</u> Pages Indexed @ Yahoo.com';
}else{
    echo ucwords($domain_name).' Has Not Been Indexed @ Yahoo.com!';
} ?>
于 2011-10-10T09:21:42.577 回答