") != 0) { $table = "Error, detected error div in the JPL result HTML"; $success = false; } /* *** 2 *** * Second form post: set the Target body. */ if(!isset($_POST['body'])) { $body_group = "all"; $find_body = "Search"; $postString = "body_group=" . $body_group . "&find_body=" . $find_body . "&sstr=" . $sstr; } else { /* When we are relaying a selectbox from Horizons, body gets set */ $sstr = $_POST['body']; $postString = "body=" . $sstr . "&select_body=Select Indicated body"; $_SESSION['ephemeris_object'] = $sstr; } curl_setopt($curl, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postString); $result = curl_exec($curl); if(strpos($result, "
with asterisks after it */ $start = strpos($result, "**"); $end = strpos($result, "\$\$SOE"); $header = substr($result, $start, $end-1-$start); /* extract the table */ $start = strpos($result, "\$\$SOE"); $end = strpos($result, "\$\$EOE"); $table = substr($result, $start, $end-$start+5); tom_save ( $table ); $ephemeris = parseTable($table); if ( count($ephemeris) > 1 ) { $_SESSION['ephemeris'] = $ephemeris; /* First line in table */ $first = $ephemeris[0]; /* XXX - really need to check against current time */ if ( $first->alt < 6.0 ) { $below_horizon = true; $status = "Ephemeris generated. (starts below horizon)"; } else { $below_horizon = false; $status = "Ephemeris generated. Ready to send to the telescope."; } } else { unset($_SESSION['ephemeris']); } } $sstr = $_POST['formObject']; // $_SESSION['ephemeris_object'] = $sstr; } // end if debugging } else { /* set defaults for first time through script, * the +7 hours takes us from MST to UT */ $sstr = "Europa"; $_SESSION['ephemeris_object'] = $sstr; $viewDate = date("Y-m-d H:i", strtotime("now +7 hours")); //$endDate = date("Y-m-d H:i", strtotime("+1 day +7 hours")); $endDate = date("Y-m-d H:i", strtotime("+12 hours +7 hours")); $table = "no data."; } function parseTable($table) { $result = array(); $temp = split("\n", $table); $i = 0; foreach($temp as $line) { $temp2 = split(",", $line); if(count($temp2) > 3) { $entry = new Entry($temp2[0], $temp2[3], $temp2[4], $temp2[5], $temp2[6]); $result[$i++] = $entry; } } return $result; } ?> MMT Ephemeris Observer Tool printJavascript($xajaxPath . "xajax"); ?> Ephemeris Telescope Control Tool What Object are you looking for? What is the start time? (in UT) YYYY-MM-DD hh:mm What is the end time? (in UT) YYYY-MM-DD hh:mm First Entry of the Ephemeris will send the telescope below the horizon" ); } else { echo ( "to:" ); } $jd = $first->jdut; $ra = $first->ra; $dec = $first->dec; $alt = $first->alt; $az = $first->az; echo("JD: $jd RA: $ra DEC: $dec (ALT: $alt AZ: $az)"); ?> HEADER..\n"; echo($header . "\n\n"); // echo "ENDHEADER..\n"; } ?> Display table data to be sent Mount Crate host: echo(MOUNT_HOST); ?> Mout Crate port: echo(MOUNT_PORT); ?> Object: echo($_SESSION[ephemeris_object]); ?> Lines in table: echo(count($_SESSION[ephemeris])); ?>
**"); $end = strpos($result, "\$\$SOE"); $header = substr($result, $start, $end-1-$start); /* extract the table */ $start = strpos($result, "\$\$SOE"); $end = strpos($result, "\$\$EOE"); $table = substr($result, $start, $end-$start+5); tom_save ( $table ); $ephemeris = parseTable($table); if ( count($ephemeris) > 1 ) { $_SESSION['ephemeris'] = $ephemeris; /* First line in table */ $first = $ephemeris[0]; /* XXX - really need to check against current time */ if ( $first->alt < 6.0 ) { $below_horizon = true; $status = "Ephemeris generated. (starts below horizon)"; } else { $below_horizon = false; $status = "Ephemeris generated. Ready to send to the telescope."; } } else { unset($_SESSION['ephemeris']); } } $sstr = $_POST['formObject']; // $_SESSION['ephemeris_object'] = $sstr; } // end if debugging } else { /* set defaults for first time through script, * the +7 hours takes us from MST to UT */ $sstr = "Europa"; $_SESSION['ephemeris_object'] = $sstr; $viewDate = date("Y-m-d H:i", strtotime("now +7 hours")); //$endDate = date("Y-m-d H:i", strtotime("+1 day +7 hours")); $endDate = date("Y-m-d H:i", strtotime("+12 hours +7 hours")); $table = "no data."; } function parseTable($table) { $result = array(); $temp = split("\n", $table); $i = 0; foreach($temp as $line) { $temp2 = split(",", $line); if(count($temp2) > 3) { $entry = new Entry($temp2[0], $temp2[3], $temp2[4], $temp2[5], $temp2[6]); $result[$i++] = $entry; } } return $result; } ?> MMT Ephemeris Observer Tool printJavascript($xajaxPath . "xajax"); ?> Ephemeris Telescope Control Tool What Object are you looking for? What is the start time? (in UT) YYYY-MM-DD hh:mm What is the end time? (in UT) YYYY-MM-DD hh:mm First Entry of the Ephemeris will send the telescope below the horizon" ); } else { echo ( "to:" ); } $jd = $first->jdut; $ra = $first->ra; $dec = $first->dec; $alt = $first->alt; $az = $first->az; echo("JD: $jd RA: $ra DEC: $dec (ALT: $alt AZ: $az)"); ?> HEADER..\n"; echo($header . "\n\n"); // echo "ENDHEADER..\n"; } ?> Display table data to be sent Mount Crate host: echo(MOUNT_HOST); ?> Mout Crate port: echo(MOUNT_PORT); ?> Object: echo($_SESSION[ephemeris_object]); ?> Lines in table: echo(count($_SESSION[ephemeris])); ?>
HEADER..\n"; echo($header . "\n\n"); // echo "ENDHEADER..\n"; } ?>