$num fields in line $row:
\n";
$row++;
for ($c=0; $c < $num; $c++) {
// echo $c ." " . $data[$c] . "
\n";
if ($oldTime == $data[1]) {
}else {
$json_string .= $data[0] . "," .$data[1]. ",". $data[5] ;
$oldTime = $data[1];
}
}
if ($oldTime == $data[1]) {
$json_string .="," .$data[6] ;
}
if($data[2] == "29000000"){
$json_string .= ",-26.4,-27.6,".$Call_sign.",".$Pass_Key."\n\r";
}
}
//$json_string .= "\r\n";
//API Url
$url = 'http://rfnoise.amsatsa.org.za/hf_noise/upload/jason_upload.php';
//Initiate cURL.
$ch = curl_init($url);
//Tell cURL that we want to send a POST request.
curl_setopt($ch, CURLOPT_POST, 1);
//Attach our encoded JSON string to the POST fields.
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_string); //$jsonDataEncoded);
//Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
//Execute the request
$result = curl_exec($ch);
fclose($handle);
//echo $json_string;
echo "posting result " . $result ;
}
}
?>