Skip to content

Instantly share code, notes, and snippets.

@mbunge
Created June 26, 2012 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbunge/2999250 to your computer and use it in GitHub Desktop.
Save mbunge/2999250 to your computer and use it in GitHub Desktop.
Display a converted raw http message
<?php
/**
* @author Marco Bunge
* @copyright 2012 Marco Bunge <efika@rubymatrix.de>
*/
$string = 'HTTP/1.1 200 OK
Server: Apache/1.3.29 (Unix) PHP/4.3.4
Content-Length: (Größe von infotext.html in Byte)
Content-Language: de (nach RFC 3282 sowie RFC 1766)
Connection: close
Content-Type: text/html
(Inhalt von infotext.html)
hallo du.
ich bin eine msg!';
$startBody = false;
foreach (explode("\r\n", $string) as $output) {
if (empty($output)) {
$startBody = true;
}
if ($startBody)
echo $output;
else
header($output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment