//make the request
if (isset($type) && $location != null && $from != null && $to != null) {
    //$type = "temperature";
    $response_readings = $wsn_api->get_reading_by_time($type, $from, $to);
    // decode json
    $result_temp_obj = json_decode($response_readings);
    // get the meshes
    $temp_obj = $result_temp_obj->{'data'};
    // get the values $mesh_obj contains list of mesh as name=value pair
    foreach ($temp_obj as $temp) {
        echo "<tr>" . "<td>" . $temp->{'sensor_id'} . "</td>" . "<td>" . $temp->{'mesh_name'} . "</td>" . "<td>" . $temp->{'time'} . "</td>" . "<td>" . $temp->{'reading'} . "</td>" . "</tr>";
    }
} else {
    if (isset($type) && $location != null) {
        //$type = "temperature";
        $response_readings = $wsn_api->get_reading_by_location($type, $location);
        // decode json
        $result_temp_obj = json_decode($response_readings);
        // get the meshes
        $temp_obj = $result_temp_obj->{'data'};
        // get the values $mesh_obj contains list of mesh as name=value pair
        foreach ($temp_obj as $temp) {
            echo "<tr>" . "<td>" . $temp->{'sensor_id'} . "</td>" . "<td>" . $temp->{'mesh_name'} . "</td>" . "<td>" . $temp->{'time'} . "</td>" . "<td>" . $temp->{'reading'} . "</td>" . "</tr>";
        }
    } else {
        if (isset($type) && $location == null) {
            //$type = "temperature";
            $response_readings = $wsn_api->get_reading($type);
            // decode json
            $result_temp_obj = json_decode($response_readings);
            // get the meshes