需要将自己的美女图片数据提交给百度,以前都是sitemap或者手工推送,现在有个更好的方法了,百度提供了自动推送的功能,任何站长都可以用
下面是方法,备用
public function pushall_m(){
$this->check_token();
$sql="select * from 表名字 where 条件;
$result=$this->db->query($sql);
$sites=$result->result_array();
foreach($sites as $k=>$v){
$table=get_sites_table_name($v['id']);
$sql="select * from ".$table." where 条件 order by id desc limit 50";
$result=$this->db->query($sql);
$result=$result->result_array();
$urls = array();
foreach ( $result as $v1){
$urls[]="http://www.memei520.com".get_show_url($v1);
}
$token=$v['zhanzhang_tijiao_code'];
if(!$token){
echo "站长提交key is null";
continue;
}
$s='www.memei520.com';$api="http://data.zz.baidu.com/urls?site=".$s."&token=".$token;
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo $result;
}
}