必應(yīng)搜索v7.0
官方文檔是php5.6x,調(diào)整代碼
函數(shù)getbing($url,$key) {
$ ch = curl _ init();
$ user _ agent = " Mozilla/5.0(Windows NT 5.1)apple WebKit/537.36(KHTML,喜歡Gecko)Chrome/33 . 0 . 1750 . 146 Safari/537.36 ";
curl_setopt($ch,CURLOPT_URL,$ URL);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Ocp-Apim-Subion-Key:')。$key。''));
curl_setopt($ch,CURLOPT_TIMEOUT,8);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_NOSIGNAL,true);
curl_setopt($ch,CURLOPT_USERAGENT,$ USER _ AGENT);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
$ data = curl _ exec($ ch);
curl _ close($ ch);
返回$ data
}
用法:
$ bing = getTokens(' https://API . cognitive . Microsoft . com/bing/v 7.0/search?Q = '。urlcode(關(guān)鍵字)。&:count = 10 & amp;offset= '。$ p . 0 & amp。mkt = zh-tw & amp;Safesearch =適中',$ key = " web search key ");
$p是分頁偏移量!
參考:https://docs . Microsoft . com/en-us/azure/cognitive-services/bing-web-search/quick starts/PHP
https://docs . Microsoft . com/en-us/rest/API/cognitive services/bing-web-API-V7-reference # market-codes
http://www.zendei.com/article/14132.html
1.《必應(yīng)搜索 必應(yīng) Web 搜索 API v7.0》援引自互聯(lián)網(wǎng),旨在傳遞更多網(wǎng)絡(luò)信息知識,僅代表作者本人觀點,與本網(wǎng)站無關(guān),侵刪請聯(lián)系頁腳下方聯(lián)系方式。
2.《必應(yīng)搜索 必應(yīng) Web 搜索 API v7.0》僅供讀者參考,本網(wǎng)站未對該內(nèi)容進行證實,對其原創(chuàng)性、真實性、完整性、及時性不作任何保證。
3.文章轉(zhuǎn)載時請保留本站內(nèi)容來源地址,http://f99ss.com/shehui/1488523.html