Project

General

Profile

CheckIP.php

CheckIP.php - Caching Headers - NOYB NOYB, 02/02/2017 07:45 PM

 
1
<?php
2
/*
3
HTTP/1.1 200 OK
4
Content-Type: text/html
5
Server: DynDNS-CheckIP/1.0
6
Cache-Control: no-cache
7
Pragma: no-cache
8
Content-Length: 105
9
Connection: close
10
<html><head><title>Current IP Check</title></head><body>Current IP Address: 123.456.78.90</body></html>
11
*/
12

    
13

    
14
$result = headers();
15
//$result = header_register_callback('headers');
16

    
17

    
18
print '<html><head><title>Current IP Check</title></head><body>Current IP Address: ' . $_SERVER['REMOTE_ADDR'] . '</body></html>';
19
print "\r\n";
20

    
21

    
22
function headers() {
23
        header_remove();
24

    
25
#        header_remove('Date');
26
        header_remove('Expires');
27

    
28
        header_remove('Server');
29
        header_remove('X-Powered-By');
30

    
31
        header('Cache-Control: no-cache');
32
        header('Connection: close');
33
#        header('Content-Length:');
34
#        header('Content-Type:');
35
        header('Pragma: no-cache');
36
        header('Server: DynDNS-CheckIP/1.0');
37
}
38
?>