你可以采用楼上的写法 也可以采用curl来获取,最重要的是要看你啥需求。

解决方案 »

  1.   

    多测试几次filegetcontents,实在不行就curl
    一般就是伪造useragent和referer,也许再带个cookie
      

  2.   


    <?php 
    $url="http://detail.tmall.com/item.htm?spm=a230r.1.0.0.MlI5e4&id=40364502055&ad_id=&am_id=&cm_id=140105335569ed55e27b&pm_id";
    $content = getcurl($url);
    echo $content;
        function getcurl($url){
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
    curl_setopt($ch, CURLOPT_MAXREDIRS,20);
    $file_contents = curl_exec($ch);
    return $file_contents;
    curl_close($ch);
        }
    ?>其中curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);设置比较重要,可以用来跟随天猫的重定向页面。