[accordion title=”使用步骤”]
只需要将这一段代码粘贴到你的wordpress主题当中的function.php文件中,就好了。
然后你的APPID token和你的appid各位老铁,去百度熊掌号官方注册,注册成功以后即可粘贴到里面就好了。懒人代码,粘贴到你的主题中就好了。
[/accordion]
function send_xzh(){ $urls = array(); $urls=get_permalink($post_ID); $api = 'http://data.zz.baidu.com/urls?appid=你的APPID&token=你的token&type=realtime'; $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; //要不要判断提交结果自己选择,这里不判断 }