summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--function.php3
-rw-r--r--getheader.php4
-rw-r--r--header.php68
-rw-r--r--index.php75
-rw-r--r--robots.txt2
5 files changed, 144 insertions, 8 deletions
diff --git a/function.php b/function.php
index 9d957a5..87ec766 100644
--- a/function.php
+++ b/function.php
@@ -1,9 +1,12 @@
<?php
function getHeader($url){
+ $agent = "Retrieve HTTP headers online. v0.1";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_USERAGENT, $agent);
$response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
diff --git a/getheader.php b/getheader.php
index a27400e..8beeb90 100644
--- a/getheader.php
+++ b/getheader.php
@@ -9,4 +9,6 @@ if($_SERVER['REQUEST_METHOD'] != "POST"){
}
$header = getHeader($_POST['url']);
-
+if ( ! $header ){
+ $header = "Couldn't retrieve URL. Please check if the website is available and try again.";
+}
diff --git a/header.php b/header.php
index 082135a..1a41233 100644
--- a/header.php
+++ b/header.php
@@ -3,7 +3,58 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
- <title>Check HTTP Headers online!</title>
+ <style>
+ html {
+ position: relative;
+ min-height: 100%;
+}
+
+body {
+ margin-bottom: 60px;
+}
+
+a {
+ color: #3083D6;
+}
+
+/* navbar */
+
+.navbar-default {
+ background-color: #3083D6 ;
+ border-color: #3083D6 ;
+ background: #3083D6 ;
+}
+
+.navbar-default .navbar-brand {
+ color: white;
+}
+
+.navbar-default .navbar-brand:hover,
+.navbar-default .navbar-brand:focus {
+}
+
+.navbar-default .navbar-nav > li > a {
+ color: white;
+}
+
+
+/* footer */
+
+.footer {
+ background-color: #3083D6 ;
+ border-color: #3083D6 ;
+ background: #3083D6 ;
+ color: white ;
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+}
+
+.footer-a {
+ color: white;
+}
+ </style>
+ <title>Header: <?php echo htmlentities($_POST['url']); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'>
</head>
@@ -11,20 +62,31 @@
<nav class="navbar navbar-default navbar-custom" role="navigation">
<div class="container">
<div class="navbar-header">
- <a class="navbar-brand" href="">Home</a>
+ <a class="navbar-brand" href=""><span class="glyphicon glyphicon-home"></span> Home</a>
</div>
</div>
</nav>
<div class="container">
<div class="text-center">
<div class="row">
+ <h3><u><?php echo htmlentities($_POST['url']); ?></u></h3>
+ <br>
<pre>
<?php
require 'getheader.php';
- echo $header;
+ echo htmlentities($header);
?>
</pre>
</div>
</div>
</div>
+ <div class="footer">
+ <div class="container">
+ <div class="row">
+ <div class="text-right">
+ <p>Copyright 2014 <a class="footer-a" href="//www.moehm.org/" target="_blank" title="https://www.moehm.org/">Maximilian M&ouml;hring</a></p>
+ </div>
+ </div>
+ </div>
+ </div>
</body>
diff --git a/index.php b/index.php
index 6f8cd48..20aca4b 100644
--- a/index.php
+++ b/index.php
@@ -3,6 +3,61 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
+ <style>
+ html {
+ position: relative;
+ min-height: 100%;
+}
+
+body {
+ margin-bottom: 60px;
+}
+
+a {
+ color: #3083D6;
+}
+
+/* navbar */
+
+.navbar-default {
+ background-color: #3083D6 ;
+ border-color: #3083D6 ;
+ background: #3083D6 ;
+}
+
+.navbar-default .navbar-brand {
+ color: white;
+}
+
+.navbar-default .navbar-brand:hover,
+.navbar-default .navbar-brand:focus {
+}
+
+.navbar-default .navbar-nav > li > a {
+ color: white;
+}
+
+
+/* footer */
+
+.footer {
+ background-color: #3083D6 ;
+ border-color: #3083D6 ;
+ background: #3083D6 ;
+ color: white ;
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+}
+
+.footer-a {
+ color: white;
+}
+.footer-a:hover {
+ color: white;
+ text-decoration: underline;
+}
+ </style>
<title>Check HTTP Headers online!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'>
@@ -11,24 +66,27 @@
<nav class="navbar navbar-default navbar-custom" role="navigation">
<div class="container">
<div class="navbar-header">
- <a class="navbar-brand" href="">Home</a>
+ <a class="navbar-brand" href=""><span class="glyphicon glyphicon-home"></span> Home</a>
</div>
</div>
</nav>
<div class="container">
<div class="text-center">
<div class="row">
+ <h3>Retrieve HTTP Headers Online!</h3>
+ <p>Check the response headers for websites. <br> Enter a URL and hit the submit button.</p>
+ <br>
<form class="form-horizontal" action="/header" method="POST">
<fieldset>
+<legend></legend>
<!-- Form Name -->
-<legend>Insert URL</legend>
<!-- Text input-->
<div class="form-group">
- <label class="col-md-4 control-label" for="textinput">URL:</label>
+ <label class="col-md-4 control-label" for="textinput">http://</label>
<div class="col-md-4">
- <input id="url" name="url" placeholder="http://example.com" class="form-control input-md" required="" type="text">
+ <input id="url" name="url" placeholder="Insert URL here." class="form-control input-md" required="" type="text">
</div>
</div>
@@ -46,4 +104,13 @@
</div>
</div>
</div>
+ <div class="footer">
+ <div class="container">
+ <div class="row">
+ <div class="text-right">
+ <p>Copyright 2014 <a class="footer-a" href="//www.moehm.org/" target="_blank" title="https://www.moehm.org/">Maximilian M&ouml;hring</a></p>
+ </div>
+ </div>
+ </div>
+ </div>
</body>
diff --git a/robots.txt b/robots.txt
new file mode 100644
index 0000000..1f53798
--- /dev/null
+++ b/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /