echo p($_ . $_lang['checking_if_config_exist_and_writable']); if (!@($conn = mysql_connect($_SESSION['database_server'], $_SESSION['database_user'], $_SESSION['database_password']))) { $errors += 1; $_ = echo_failed($_lang['database_connection_failed']) . "<p>" . $_lang['database_connection_failed_note']; } else { $_ = echo_ok(); } echo p($_ . $_lang['creating_database_connection']); // check mysql version if ($conn) { if (strpos(mysql_get_server_info(), '5.0.51') !== false) { $_ = echo_failed($_lang['warning']) . ' <strong>' . $_lang['mysql_5051'] . '</strong>'; echo p($_ . $_lang['checking_mysql_version']); echo p(echo_failed($_lang['mysql_5051_warning'])); } else { $_ = echo_ok() . ' <strong>' . $_lang['mysql_version_is'] . mysql_get_server_info() . ' </strong>'; echo p($_ . $_lang['checking_mysql_version']); } // check for strict mode $mysqlmode = @mysql_query("SELECT @@global.sql_mode"); if (@mysql_num_rows($mysqlmode) > 0 && !is_webmatrix() && !is_iis()) { $modes = mysql_fetch_array($mysqlmode, MYSQL_NUM); //$modes = array("STRICT_TRANS_TABLES"); // for testing foreach ($modes as $mode) { if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { echo p($_lang['checking_mysql_strict_mode']); echo p(echo_failed($_lang['warning']) . '<strong> ' . $_lang['strict_mode'] . '</strong>'); echo p(echo_failed($_lang['strict_mode_error'])); } } }
$response = run_curl_request($curl); // we either got a 303 redirect or we got a 200 or something else! $iFrameUri = false; $requestRdf = false; if ($response->info['http_code'] == 303) { echo_ok("Recieved 303 Redirect HTTP code."); echo_ok("Redirect to URI: <a target=\"_new\" href=\"" . $response->info['redirect_url'] . "\">" . $response->info['redirect_url'] . "</a>"); $iFrameUri = $response->info['redirect_url']; $requestRdf = true; } elseif ($response->info['http_code'] == 302) { echo_warning("Recieved 302 Redirect HTTP code. This should be a 303 as we are assuming support for HTTP1.1 ~ 302 is so last century :)"); echo_ok("Redirect to URI: <a target=\"_new\" href=\"" . $response->info['redirect_url'] . "\">" . $response->info['redirect_url'] . "</a>"); $iFrameUri = $response->info['redirect_url']; $requestRdf = true; } elseif ($response->info['http_code'] == 200) { echo_ok("Recieved 200 OK HTTP code."); $iFrameUri = $uri; } elseif ($response->info['http_code'] == 404) { echo_error("Got HTTP response code of 404 Not Found."); $iFrameUri = false; } else { echo_error("Unexpected response code: '" . $response->info['http_code'] . "'. Expecting 303 Redirect or 200 OK."); $iFrameUri = false; } if ($iFrameUri) { echo "<iframe id=\"herbal-html-response\" src=\"{$iFrameUri}\"></iframe>"; } else { echo_error("Errors prevent retrieval of HTML."); } if (!$requestRdf) { echo_info("No 303 redirect so stopping here.");
// it is unlikely people would do it all with subdomains. if (isset($parts['path'])) { echo_ok("The path component is '" . $parts['path'] . "'"); } else { echo_warning("The URI lacks a path component. Are you sure this is what you intended?"); } // they shouldn't have a query string // this stops the use of db queries if (isset($parts['query'])) { echo_error("The URI contains the query string: '" . $parts['query'] . "'. This is not permitted."); $proceed = false; } else { echo_ok("The URI lacks a query string component which is a good thing."); } //var_dump($parts); } if ($proceed) { echo_ok("Format of URI appears OK. Continuing test."); ?> <script type="text/javascript"> $('#request-html-results').html('Loading ...'); $('#request-html-results').show('slow'); $('#request-html-results').load('tests/request_html.php', 'uri=' + '<?php echo $uri; ?> ' ); </script> <?php } else { echo_error("Errors prevent further checking of URI."); }
require_once 'common.php'; ?> <h2>Requesting RDF Format Data</h2> <?php $uri = $_GET['uri']; // get default curl handle $curl = get_curl_handle($uri); // set other things here curl_setopt($curl, CURLOPT_HTTPHEADER, array("Accept: application/rdf+xml")); $response = run_curl_request($curl); echo_info("Requesting RDF by passing 'Accept: application/rdf+xml' header."); if ($response->info['http_code'] != 303) { echo_error("Unexpected response code: '" . $response->info['http_code'] . "'. Expecting 303 Redirect to RDF."); } else { echo_ok("Recieved 303 Redirect HTTP code."); echo_ok("Redirect to URI: <a target=\"_new\" href=\"" . $response->info['redirect_url'] . "\">" . $response->info['redirect_url'] . "</a>"); echo_info("Had 303 redirect so will request RDF data for parsing."); $rdfUri = $response->info['redirect_url']; ?> <script type="text/javascript"> $('#parse-rdf-results').html('Loading ...'); $('#parse-rdf-results').show('slow'); $('#parse-rdf-results').load('tests/parse_rdf.php', 'rdf_uri=' + '<?php echo $rdfUri; ?> ' + '&specimen_uri=' + '<?php echo $uri; ?> ' ); </script> <?php