davidtingsu
davidtingsu

Reputation: 1180

File is getting truncated with cURL

I am using the following method to get JSON from a url. It works when I output the json in the php shell, but on the website, the output is truncated. Is there an explanation. Here is the url I am trying to retrieve: 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;                                             
}    

Here is my truncated output:

{"status":"success","type":"PROCESS_CODE","properties":{"operation":"save_proc","name":"slope_intercept_tester","script":{"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) return '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'){ state.multibuf = new Object(); } outObj.inputs = new Array(); var noted = new Object(); for(i=0; i=2){ for(j=0; j

Upvotes: 1

Views: 2359

Answers (1)

Georges Chitiga
Georges Chitiga

Reputation: 88

That's a JSON with Javascript inside, did you decode the JSON with php json_decode ?

Look in the browser source file, it might be all there but hidden by the browser.

Upvotes: 1

Related Questions