Jump to content

How to send this array of header information ?


Dareros
Go to solution Solved by CroNiX,

Recommended Posts

Hi;

 

I have an array of header information that i want to send before doing an echo to the page. Something like :

// Send the header information in the array below, then
echo $html;
die();

The information in the array is for example :

HTTP/1.1 200 OK
Date: Sat, 09 Aug 2014 00:01:36 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.9-4ubuntu2
X-Logged-In: False
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Cache-Control: public, must-revalidate, proxy-revalidate
Expires: Sat, 09 Aug 2014 02:01:36 GMT
Connection: keep-alive, close
Pragma: public
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8

Thank you.

Link to comment
Share on other sites

  • Solution

Did you try just using a foreach and outputting the header?

$headers = array(
  'HTTP/1.1 200 OK',
  'Date: Sat, 09 Aug 2014 00:01:36 GMT',
  'Server: Apache/2.2.22 (Ubuntu)',
  //...the rest
);
foreach($headers as $header)
{
  header($header);
}
exit($html);
Link to comment
Share on other sites

Why on earth do you tell your users the exact version of the webserver and PHP? What are they supposed to do with this information?

 

Actually, it does help some people: Attackers can now skip the step of fingerprinting your software, because you've already told them everything they need to know. How kind of you.

Link to comment
Share on other sites

Why on earth do you tell your users the exact version of the webserver and PHP? What are they supposed to do with this information?

 

Actually, it does help some people: Attackers can now skip the step of fingerprinting your software, because you've already told them everything they need to know. How kind of you.

Do you mean those lines :

Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.9-4ubuntu2

If so, can i remove them without causing any user experience issue ? because i wouldn't like to change header to not make any thing wrong. I know my skills aren't top too mush.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.