0

I'm using following script:

<?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;
}

?>

but appear don't working

anyone have any working script? thanks

grigione
  • 697
  • 2
  • 11
  • 37
  • What are you trying to do and what is not working? – Quasdunk Oct 10 '11 at 09:14
  • i,m tryng to get numer of indexed pages in yahooo as results of this: http://siteexplorer.search.yahoo.com/search?p=www.site.com the script give me always zero as results – grigione Oct 10 '11 at 09:17

1 Answers1

-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!';
} ?>
Mohit Bumb
  • 2,466
  • 5
  • 33
  • 52
  • but my output is "Davidwinstead.com Has 126 Pages Indexed @ Yahoo.com" – Mohit Bumb Oct 10 '11 at 09:35
  • with your script i get following error Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/a7392834/public_html/indexed6.php on line 4 edit i have removed final slash but i get Davidwinstead.com Has Not Been Indexed @ Yahoo.com! – grigione Oct 10 '11 at 09:38
  • error is disappeared but i get always Davidwinstead.com Has Not Been Indexed @ Yahoo.com! – grigione Oct 10 '11 at 09:45
  • This is not working. Please provide some other option currently present – sujivasagam Oct 13 '16 at 09:40