How to use php to push to Baidu webmaster platform

You need to submit your own beauty picture data to Baidu. It used to be sitemap or manual push. Now there is a better way. Baidu provides an automatic push function, which can be used by any webmaster.
The following is the method, spare
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;
    }
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326407872&siteId=291194637