迪拜de天空

从未如此喜欢

php检查文章是否被百度收录

php检查文章是否被百度收录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function checkBaidu($url) {

$url= 'http://www.baidu.com/s?wd='. $url;

$curl= curl_init();

curl_setopt($curl, CURLOPT_URL, $url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$rs= curl_exec($curl);

curl_close($curl);

$arr= parse_url($url);

if(strpos($arr['query'], 'http://')) {

$arr['query'] = str_replace('http://', '', str_replace('wd=', '', $arr['query']));

} else{

$arr['query'] = str_replace('wd=', '', $arr['query']);

}

if(strpos($arr['query'], '?')) {

$str= strstr($arr['query'], '?');

$arr['query'] = str_replace($str, '', $arr['query']);

}

if(strpos($arr['query'], '/')) {

$narr= explode('/', $arr['query']);

$arr['query'] = $narr[0];

}

if(strpos($rs, ''.$arr['query'].'')) {

return1;

} else{

return0;

}

}

评论系统未开启,无法评论!