Welcome Guest, Not a member yet? Register   Sign In
$_SERVER['HTTP_REFERER'] not working using codeigniter
#1

[eluser]Unknown[/eluser]
Hi All, quiet new to Codeigniter so apologies if i am being dumb (i have also tried searching for this)

I am trying to set-up a system where 3rd party sites can interact with my Codeigniter site but I need a way of grabbing their domain. Here is a test I conducted to try and get it working.

I created a 3rd party page called mydomain.com/index.php and added this code

Code:
echo file_get_contents('http://myotherdomain.com/');

I created an non Codeigniter script at myotherdomain.com/index.php and added this code

Code:
echo $_SERVER['HTTP_REFERER'];

Then if i browse mydomain.com/index.php I get 'mydomain.com/index.php'



But if I install a fresh copy of Codeigniter 2.1.0 at myotherdomain.com and alter the welcome controller to

Code:
public function index()
{
    //$this->load->view('welcome_message');

    $this->load->library('user_agent');

    echo 'Hello World';

    echo '<br><br> ------------------------------------------- <br><br>';

    echo $_SERVER['HTTP_REFERER'];

    echo '<br><br> ------------------------------------------- <br><br>';

    print_r($_SERVER);

    echo '<br><br> ------------------------------------------- <br><br>';

    print_r($this->input->server());

    echo '<br><br> ------------------------------------------- <br><br>';

    echo $this->agent->referrer();

}

and then browse mydomain.com/index.php neither $_SERVER or agent->referrer() return anything.

Any ideas (i am sure I have missed something really simple)?




Theme © iAndrew 2016 - Forum software by © MyBB