'getregiontop', 'group' => $GROUP, 'password' => $PASSWORD, 'type' => 'scripts' ); array_walk($params, function(&$value, $key) { $value = urlencode($key)."=".urlencode($value); } ); $postvars = implode('&', $params); if (!($curl = curl_init())) { print 0; return; } curl_setopt($curl, CURLOPT_URL, $URL); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postvars); curl_setopt($curl, CURLOPT_ENCODING, true); $return = curl_exec($curl); curl_close($curl); #### # II. Check for success. $success = urldecode( wasKeyValueGet( "success", $return ) ); if($success == 'False') { echo 'Unable to query the top scripts: ' .urldecode( wasKeyValueGet( "error", $return ) ); die; } #### # III. Dump JSON for DataTables. echo json_encode( array( "data" => array_chunk( wasCSVToArray( urldecode( wasKeyValueGet( "data", $return ) ) ), 5 # We split the CSV in 5: score, task name, UUID, Owner and Position ) ) ); ?>