<?
header('Content-Type:text/html;charset=utf-8');
$xmldata =file_get_contents("https://xxx/sitemap.xml");
$xmlstring = simplexml_load_string($xmldata,'SimpleXMLElement',LIBXML_NOCDATA);
$value_array = json_decode(json_encode($xmlstring),true);
$url = [];
for ($i =0;$i < count($value_array['url']);$i++){
echo $value_array['url'][$i]['loc']."<br/>";
$url[]= $value_array['url'][$i]['loc'];
}
$api ='百度推送链接';
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n",$url),
CURLOPT_HTTPHEADER => array('Content-Type:text/plain'),
);
curl_setopt_array($ch, $options);
$result =curl_exec($ch);
echo $result;...
代码中推送地址及sitemap地址自行修改
© 版权声明
所有资源都是收集于互联网络,如有侵权请联系网站客服删除谢谢
THE END
暂无评论内容