Jump to content

modifying headers


Lethe

Recommended Posts

When I first run my php script I need to identify my script to others by modifying some sent header information as below...

 

ini_set('user_agent', 'somename');

header('From: [email protected]');

flush();

 

I can confirm that ini_set is working by: echo ini_get('user_agent');

 

I can then check - in the same script - my headers using either:

 

foreach (getallheaders() as $name => $value) {

    echo "$name: $value<br />";

}

 

or

 

var_dump($_SERVER);

 

But neither of these show the changed headers. All the headers are still the same.

 

What am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/153173-modifying-headers/
Share on other sites

Ummm, nope still nothing. I've already done everything mentioned in the post.

 

To confirm I try to change the headers before any html is outputted and there are no characters before or after the php tags. I've tried all the suggestions mentioned here http://ca.php.net/manual/en/function.flush.php

 

The header information returned is:

 

Host: localhost:8888

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3) Gecko/20090305 Firefox/3.1b3

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Cache-Control: max-age=0

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/153173-modifying-headers/#findComment-804669
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.