为什么$URL = 'http://gw.api.sandbox.360buy.com/routerjson';
echo file_get_contents($URL);这样可以,但是
$ch = curl_init();
// 2. 设置选项,包括URL
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
// 3. 执行并获取HTML文档内容
$output = curl_exec($ch);
// 4. 释放curl句柄
curl_close($ch);
echo $output;这样却不可以呢,这是为什么呢

解决方案 »

  1.   

    怎么不可以?报错?curl 不支持
      

  2.   

    开始没有反应,等很长时间会提示 couldn't connect to host
      

  3.   

    代码本身没问题
    {"error_response": {"code":"7","zh_desc":"缺少时间戳参数","en_desc":"Missing Timestamp"}}
      

  4.   

    也是没看出语法问题,你获取的时候,ping一下看看,是不是能ping通
      

  5.   

    {"error_response": {"code":"7","zh_desc":"缺少时间戳参数","en_desc":"Missing Timestamp"}}正常情况应该返回上面的错误.如果长时间没有反应的话 可能你的网络或者某些安全软件拦截了吧