note 104307 modified in function.getallheaders by danbrown

From: Date: Wed, 08 Jun 2011 14:35:33 +0000
Subject: note 104307 modified in function.getallheaders by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-180335@lists.php.net to get a copy of this message
dont forget to add the content_type and content_lenght if your are uploading file: <?php function emu_getallheaders() { foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_') { $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))); $headers[$name] = $value; } else if ($name == "CONTENT_TYPE") { $headers["Content-Type"] = $value; } else if ($name == "CONTENT_LENGTH") { $headers["Content-Length"] = $value; } } return $headers; } ?> chears magno c. heck --was-- dont forget to add the content_type and content_lenght if your are uploading file: function emu_getallheaders() { foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_') { $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))); $headers[$name] = $value; } else if ($name == "CONTENT_TYPE") { $headers["Content-Type"] = $value; } else if ($name == "CONTENT_LENGTH") { $headers["Content-Length"] = $value; } } return $headers; } chears magno c. heck http://php.net/manual/en/function.getallheaders.php

« previous php.notes (#180335) next »