debugOn(); $debug = false; /* Originally written by Dallan Porter * minor modifications by Tom Trebisky 10-29-2008 */ /* Horizons will display a select box if multiple objects match a query string, store it here */ $showSelectBox = false; $selectBox = ""; $header = ""; if(eregi("coma", $_SERVER['SERVER_NAME'])) { /* must be running on Dallan's workstation and not hacksaw */ $xajaxPath = "../../"; } else { $xajaxPath = "../engineering/"; } $ephemeris = array(); if($debug) { $status = "(Debug mode) Ready for search"; } else { $status = "Ready for search"; } if(isset($_POST['process']) && $_POST['process'] == "true") { unset($_SESSION['ephemeris']); if($debug) { /* if debugging, dont keep hammering JPL with queries, use dummy data... */ for($i=0; $i<30; $i++) { $entry = new Entry(rand(0, 100), rand(0, 100), rand(0, 100)); $ephemeris[$i] = $entry; } $_SESSION['ephemeris'] = $ephemeris; $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")); $status = "(Debug mode) Ephemeris generated. Ready to send to the telescope."; } else { $success = true; if($success) { $viewDate = $_POST['formStartDate']; $endDate = $_POST['formEndDate']; $endTime = strtotime($viewDate); $url = "http://ssd.jpl.nasa.gov/horizons.cgi"; $sstr = $_POST['formObject']; /* Search string */ // $_SESSION['object'] = $_POST['formObject']; $body_group = "all"; $find_body = "Search"; $l_str = "mount hopkins"; $s_lookup = "Search"; $oq_1 = "1"; $oq_4 = "1"; $extra_prec = "YES"; $obj_data = "YES"; $time_fmt = "JD"; $ang_format = "DEG"; $set_table = "Use Settings Above"; $set_table_settings = "1"; $obj_data = "YES"; $csv_format = "YES"; $start_time = $viewDate; $stop_time = $endDate; $step_size = "1"; $interval_mode = "m"; $set_time_span = "Use%20Specified%20Times"; /* First form post: Set the location to Mount Hopkins */ $postString = "l_str=" . $l_str . "&s_lookup=" . $s_lookup; $curl = curl_init($url); curl_setopt($curl, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $postString); $result = curl_exec($curl); if(strpos($result, "
") != 0) { $table = "Error, detected error div in the JPL result HTML"; $success = false; } /* Second form post: set the object body */ if(!isset($_POST['body'])) { $postString = "body_group=" . $body_group . "&find_body=" . $find_body . "&sstr=" . $sstr; } else { $sstr = $_POST['body']; $postString = "body=" . $sstr . "&select_body=Select Indicated body"; } curl_setopt($curl, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postString); $result = curl_exec($curl); if(strpos($result, "
") != 0) { $table = "Error, detected error div in the JPL result HTML"; $success = false; } else if(strpos($result, "

Target Body

") != 0) { $tmpBegin = strpos($result, " 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 to:
jdut; $ra = $first->ra; $dec = $first->dec; $alt = $first->alt; $az = $first->az; echo("JD: $jd
RA: $ra
and DEC: $dec
(ALT: $alt AZ: $az)"); ?>

				
Display table data to be sent
Mount Crate host:
Mout Crate port: