summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorroot2014-11-10 21:42:55 +0100
committerroot2014-11-10 21:42:55 +0100
commitbdb371491a0b79029f180d54d76910efa8f5c79e (patch)
tree4219e2b019f42b91898df01ea0d03271d0b70fd2 /index.php
parenta55573a5aa040d171a8d162db0bbbd4a1bc7a6be (diff)
downloadhttpheader-bdb371491a0b79029f180d54d76910efa8f5c79e.tar.gz
added redis as local cache
Diffstat (limited to 'index.php')
-rw-r--r--index.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/index.php b/index.php
index 21f7439..5980a97 100644
--- a/index.php
+++ b/index.php
@@ -103,6 +103,9 @@ a {
<?php
if ( $set ){
function getInfo($url, $customHeader = array()){
+
+ require 'redis.php';
+
$agent = "Retrieve HTTP headers online. v0.1";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@@ -124,6 +127,10 @@ if ( $set ){
$host = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$result = array($request, $header, $host);
+
+ # redis. remove this line if no redis
+ $redis->set( $key, serialize($result), 60 );
+
return $result;
}
$header_info = getInfo($_REQUEST['url'], $_REQUEST['header']);
@@ -148,6 +155,7 @@ Host: "<u><?php echo strtolower(htmlentities($header_info[2])); ?></u>"</pre></h
echo "</pre>";
}
?>
+ <p>Entries are cached for 60 seconds.</p>
<?php
} else {
?>
@@ -198,6 +206,7 @@ Host: "<u><?php echo strtolower(htmlentities($header_info[2])); ?></u>"</pre></h
</fieldset>
</form>
+
<?php
}
?>
@@ -213,7 +222,6 @@ Host: "<u><?php echo strtolower(htmlentities($header_info[2])); ?></u>"</pre></h
</div>
</div>
</div>
-<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
//window.onload = function(){