織夢熊掌號api自動提交代碼
復制一下PHP代碼,新建一個PHP文件,放在網站根目錄,每天更新完后運行一次就行了!只適用于自適應站點。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <?php?? require_once ?( "include/common.inc.php" );?? require_once ?"include/arc.partview.class.php" ; require_once ( 'include/charset.func.php' );?? $year ?=? date ( "Y" );?? $month ?=? date ( "m" );? $day ?=? date ( "d" ); $dayBegin ?=? mktime (0,0,0, $month , $day , $year ); $dayEnd ?=? mktime (23,59,59, $month , $day , $year ); $query ?=? "SELECT?arch.id,types.typedir?FROM?dede_arctype?as?types?inner?join?dede_archives?as?arch?on?types.id=arch.typeid?where?pubdate<" . $dayEnd . "?AND?pubdate>" . $dayBegin . "" ;? //echo?$query;?? $urls = "" ;?? $dsql ->Execute( 'arch.id,types.typedir' , $query );? while ( $row ?=? $dsql ->GetArray( 'arch.id,types.typedir' ))??{? $urls .= "https://www.19tx.cn" . str_replace ( "{cmspath}" , "" , $row [ 'typedir' ]). "/" . $row [id]. ".html" . "," ;??}? $urls = substr ( $urls ,0,-1);?? $urls ?=? explode ( "," , $urls ); $api ?=? 'http://data.zz.baidu.com/urls?appid=熊掌號ID&token=密鑰&type=realtime' ;? //?前邊的熊掌號ID和密鑰換成自己的$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 ;?? ?> |
暫無評論...