referer() public method

Gets the referring URL of this request.
public referer ( string $default = null, boolean $local = false ) : string
$default string Default URL to use if HTTP_REFERER cannot be read from headers.
$local boolean If true, restrict referring URLs to local server.
return string Referring URL.
Example #1
0
 public function testRefererLocalFromNotLocal()
 {
     $_SERVER['HTTP_REFERER'] = 'http://lithium.com/posts/index';
     $request = new Request();
     $expected = '/';
     $result = $request->referer('/', true);
     $this->assertEqual($expected, $result);
 }
Example #2
0
 public function testRefererLocalFromNotLocal()
 {
     $request = new Request(array('env' => array('HTTP_REFERER' => 'http://lithium.com/posts/index', 'HTTP_HOST' => 'foo.com')));
     $expected = '/';
     $result = $request->referer('/', true);
     $this->assertEqual($expected, $result);
 }