需要有协议类型
echo file_get_contents("http://localhost/interface.php",true, $context);

解决方案 »

  1.   

    另外参数数组中
    header 项要写成
    'header'=> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13\r\nContent-type: application/x-www-form-urlencoded\r\n",只在双引号中 \r\n 才会生效
      

  2.   


    哦? 就是说没有HTTP这样就肯定不行了咯!!!
      

  3.   

    这点参数直接curl get 就是了
      

  4.   

    为什么会file_get_contents能获取到完整的json内容,而用curl获取却是不完整的json内容呢?