<?php
$url = 'http://list.tmall.com/search_product.htm?cat=50108176&s=0&n=60&q=%CA%D6%B1%ED&sort=s&style=w&area_code=320100#J_Filter';
$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
$data = curl_exec($ch); 
echo $data;
?>
感觉这个$url就是打印不出来,不知道这个页面是否有什么限制?

解决方案 »

  1.   

    怎么没有内容?这个不就是吗?<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html>
    <head><title>302 Found</title></head>
    <body bgcolor="white">
    <h1>302 Found</h1>
    <p>The requested resource resides temporarily under a different URI.</p>
    <hr/>Powered by Tengine
    </body>
    </html>
      

  2.   

    上面代码url中间多了空格,不过这个不是原因。
      

  3.   

    楼主,帮你试了试,确实不显示内容,不过用file_get_contents就可以,不知道为什么
      

  4.   

    回楼上的,我也知道getcontents可以,有百分之几获取不到的情况发生,所以选用curl试试看能不能提高获取成功效率的。
      

  5.   

    难道网站从定向了?
    加句这看下  $options[CURLOPT_FOLLOWLOCATION] = true;