http://detailp4p.china.alibaba.com/buyer/offerdetail/735102651.html
$curl = curl_init();
curl_setopt($curl,       CURLOPT_URL,'http://detailp4p.china.alibaba.com/buyer/offerdetail/910530421.html');
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
$content = curl_exec($curl);
echo $content;
获取不到页面呢怎么

解决方案 »

  1.   

    以下代码成功捕获页面$url = 'http://detailp4p.china.alibaba.com/buyer/offerdetail/735102651.html';  $cookie_file = dirname(__FILE__)."/cookie.txt";
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
      $contents = curl_exec($ch);
      curl_close($ch);
      echo $contents ;