我使用以下方法从网址获取JSON。它在我输出php shell中的json时有效,但在网站上,输出被截断。有没有解释。 以下是我要检索的网址:http://energylens.sfsprod.is4server.com:8080/proc/slope_intercept_tester
function get($url){
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$url);
curl_setopt($curl_handle,CURLOPT_HTTPGET,1);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,0);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$reply = curl_exec($curl_handle);
curl_close($curl_handle);
return $reply;
}
这是我的截断输出:
{ “状态”: “成功”, “类型”: “PROCESS_CODE”, “属性”:{ “操作”: “save_proc”, “名称”: “slope_intercept_tester”, “脚本”:{ “使用winsize”: 10,“materialize”:“true”,“timeout”:80000,“func”:“function(buffer,state){var outObj = new Object(); var timestamps = new Object(); outObj.msg ='processed '; if(typeof state.slope =='undefined'){state.slope = function(p1,p2){if(typeof p1!='undefined'&& typeof p2!='undefined'&& typeof p1.value!='undefined'&& typeof p1.ts!='undefined'&& typeof p2.value!='undefined'&& typeof p2.ts!='undefined'){ if(p1.ts == p2.ts)返回'inf'; return(p2.value-p1.value)/(p2.ts-p1.ts);} return'error:undefined data point parameter';}; state.intercept = function(slope,p1){if(typeof p1!='undefined'&& typeof p1.value!='undefined'&& typeof p1.ts!='undefined'){return p1 .value - (slope * p1.ts);} return'error:undefined data point parameter';};} if(typeof state.multibuf =='undefined'){sta te.multibuf = new Object(); } outObj.inputs = new Array(); var noted = new Object(); for(i = 0; i = 2){for(j = 0; j
答案 0 :(得分:1)
这是一个内置Javascript的JSON,你用php json_decode解码了JSON吗?
查看浏览器源文件,它可能就在那里但是被浏览器隐藏了。