亚洲精品视频一区二区,一级毛片在线观看视频,久久国产a,狠狠狠色丁香婷婷综合久久五月,天天做天天欢摸夜夜摸狠狠摸

當前位置: > 學(xué)習>正文

PHP 百度推送代碼,必應bing站長(cháng)網(wǎng)站管理員工具API推送代碼

2025-07-01 學(xué)習
   public function pushBaidu($urls){
        $api = 'http://data.zz.baidu.com/urls?site=https://www.php-china.com&token=你自己的百度網(wǎng)站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);
        $arrRes = json_decode($result,true);
        $remain = $arrRes['remain'];
        $success = $arrRes['success'];
        //生成網(wǎng)站地圖xml寫(xiě)入日志
        event(new AdminOperatingEvent(ApiOperating::AUTOMATIC_SITE_MAP_PUSH,intval(999999)));
        Log::info('網(wǎng)站地圖推送百度成功推送:'.$success);
        Log::info('網(wǎng)站地圖推送百度當天剩余次數:'.$remain);
    }

    public function pushBing($arr,$webUrl){
        $key="你自己的bing密鑰";
        $api = "https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlbatch?apikey=".$key;
        $urls=[
            "siteUrl"=>$webUrl,
            "urlList"=>[]
        ];
        foreach ($arr as $k => $v) {
            if($k>0){
                array_push($urls['urlList'],$v);
            }
        }
        $ch = curl_init();
        $options =  array(
            CURLOPT_URL => $api,
            CURLOPT_POST => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 0,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => json_encode($urls),
            CURLOPT_HTTPHEADER => array(
                "Accept: application/json",
                "Content-Type: application/json"
            ),
        );
        curl_setopt_array($ch, $options);
        $result = curl_exec($ch);
        $arrRes = json_decode($result,true);
        $arrRes["d"];
        Log::info('網(wǎng)站地圖推送bing成功推送');
    }
 

版權聲明: 本站僅提供信息存儲空間服務(wù),旨在傳遞更多信息,不擁有所有權,不承擔相關(guān)法律責任,不代表本網(wǎng)贊同其觀(guān)點(diǎn)和對其真實(shí)性負責。如因作品內容、版權和其它問(wèn)題需要同本網(wǎng)聯(lián)系的,請發(fā)送郵件至 舉報,一經(jīng)查實(shí),本站將立刻刪除。

亚洲精品视频一区二区,一级毛片在线观看视频,久久国产a,狠狠狠色丁香婷婷综合久久五月,天天做天天欢摸夜夜摸狠狠摸