Jump to content

header function working after HTML output; can anyone explain why?


pliant

Recommended Posts

I was asked to make a page that would register with Opentracker before redirecting to the main page of our site.  I put this script up on one of our servers running php 5.1.6, and to my very great surprise, it worked:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

        <head>

                <title>Tracking Title</title>

        </head>

        <body>

                <!-- OPENTRACKER HTML START -->

                <script defer src="http://server1.opentracker.net/?site=www.thesite.com"></script>

                <noscript><a href="http://www.opentracker.net" target="_blank"><img src="http://img.opentracker.net/" alt="page counter" border="0"></a></noscript>

                <!-- OPENTRACKER HTML END -->

        </body>

</html>

<?php header('location: http://www.thesite.com') ;?>

 

It also works on another server running the same version of php.  On an alternate server, still running 4.3.11, it gave the expected 'headers already sent' error. 

 

Can anyone explain to me why does this script works on two of my servers?  I looked through the header() manual page and was unable to find any php5 updates that would account for this.

 

Thanks for reading.

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.