欢迎访问 舍力博客(www.shuyong.net)
function baidu_check($url){ global $wpdb; $post_id = ( null === $post_id ) ? get_the_ID() : $post_id; $query="SELECT baidu_record FROM $wpdb->posts WHERE $wpdb->posts.ID='$post_id'"; $result = $wpdb->get_var($query); if ( $result != 1 ){ $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); if(!strpos($rs,'没有找到')){ $updata="UPDATE $wpdb->posts set baidu_record = 1 WHERE ID='$post_id'"; $wpdb->query($updata); return 1; } else { return 0; } } else { return 1; } } function baidu_record() { if(baidu_check(get_permalink()) == 1) { echo '<a target="_blank" title="点击查看" rel="external nofollow" href="http://zhangge.net/go/?url=http://www.baidu.com/s?wd='.get_the_title().'">百度已收录</a>'; } else { echo '<a style="color:red;" rel="external nofollow" title="点击提交,谢谢您!" target="_blank" href="http://zhangge.net/go/?url=http://zhanzhang.baidu.com/sitesubmit/index?sitename='.get_permalink().'">百度未收录</a>'; } }
function baidu_check($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); if(!strpos($rs,'没有找到')){ return 1; } else { return 0; } } function baidu_record() { if(baidu_check(get_permalink()) == 1) { echo '<a target="_blank" title="点击查看" rel="external nofollow" href="http://zhangge.net/go/?url=http://www.baidu.com/s?wd='.get_the_title().'">百度已收录</a>'; } else { echo '<a style="color:red;" rel="external nofollow" title="点击提交,谢谢您!" target="_blank" href="http://zhangge.net/go/?url=http://zhanzhang.baidu.com/sitesubmit/index?sitename='.get_permalink().'">百度未收录</a>'; } }
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。