人人人妻人人人妻人人人,99精品国产综合久久久久五月天 ,欧美白人最猛性XXXXX,日韩AV无码免费播放

News新聞

業(yè)界新聞動(dòng)態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁(yè)      樂(lè)道系統(tǒng)FAQ      PHP CURL采集百度搜尋結(jié)果圖片不顯示問(wèn)題的解決方法

PHP CURL采集百度搜尋結(jié)果圖片不顯示問(wèn)題的解決方法

標(biāo)簽: 發(fā)布日期:2017-02-03 00:00:00 289

1.根據(jù)關(guān)鍵字采集百度搜尋結(jié)果

根據(jù)關(guān)鍵字采集百度搜尋結(jié)果,可以使用curl實(shí)現(xiàn),代碼如下:

<?php
function doCurl($url, $data=array(), $header=array(), $timeout=30){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  $response = curl_exec($ch);
  if($error=curl_error($ch)){
    die($error);
  }
  curl_close($ch);
  return $response;
}
$wd = '仙劍奇?zhèn)b傳';
$url = 'http://www.baidu.com/s?wd='.urlencode($wd);
$data = array();
$header = array();
$response = doCurl($url, $data, $header, 5);
echo $response;
?>