laplace's demon

Archive for February, 2011

Twitter Updates

by on Feb.08, 2011, under Uncategorized

I guess it would be kinda cool if my posts are published as twitter entries. I have installed a new plugin. And this is my first post to test it out.

1 Comment more...

Getting PHP headers without apache mod headers

by on Feb.08, 2011, under php, Programming

It sometimes happen. You are in a restricted environment -like a shared hosting- and somehow you want to reach the custom headers without enabling the apache module “mod_headers”. Than following little function will do your job.

function getHeaders()
    {
        $headers = array();
        foreach ($_SERVER as $k => $v)
        {
            if (substr($k, 0, 5) == "HTTP_")
            {
                $k = str_replace('_', ' ', substr($k, 5));
                $k = str_replace(' ', '_', strtolower($k));
                $headers[$k] = $v;
            }
        }
        return $headers;
    }

P.S. If you have the possibility to use the mod_headers, than you’re free to use apache_get_headers() function.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...