View previous topic :: View next topic |
Author |
Message |
Vattu -
Joined: 19 Oct 2006 Posts: 1 Location: Sweden
|
Posted: Thu Oct 19, 2006 2:45 am Post subject: getallheaders() without apache |
|
|
I'm using the script Zina for my music streaming, but now I changed from Apache to Abyss, just because Abyss is so awesome.
But when I changed to Abyss, the function getallheaders() didn't work, so I removed it. As I thought, the headers didn't get properly loaded into winamp, and I found out that getallheaders() only works for php with apache.
The code in Zina looks like this:
Code: | $headers = @getallheaders();
if (isset($headers['Range'])) {
fseek($in, preg_replace('/[^0-9]+/','',$headers['Range']));
} |
I found the following code on this page:
Code: | function emu_getallheaders() {
foreach($_SERVER as $h=>$v)
if(ereg('HTTP_(.+)',$h,$hp))
$headers[$hp[1]]=$v;
return $headers;
} |
So now I thought that the headers would work just as with apache, but I got the same result. The song name in winamp that would look like this:
"Larry Finnegan - Bound for houston"
instead looks like this after I begin playing it:
index.php?l=10&p=L%2FLARRY%20FINNEGAN%20-%20IN%20MEMORIAM%2FCD%202%2F06%20-%20Bound%20for%20Houston.mp3
I suspect that I've either forgot something, or that emu_getallheaders() is not exactly written as the apache function getallheaders().
Any help solving the header problem is appreciated! |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Thu Oct 19, 2006 1:03 pm Post subject: Re: getallheaders() without apache |
|
|
getallheaders is only supported when using mod_php under Apache. We don't understand why Zina people are using this function when there are better and server-independant ways in PHP to do the same thing.
Anyway, here is a function which will emulate getallheaders on Abyss Web Server (and any server which exports the ALL_RAW CGI variable such as IIS):
Code: | function emu_getallheaders() {
$lines = explode("\n", $_SERVER['ALL_RAW']);
$headers = array();
foreach($lines as $line) {
list($name, $value) = explode(': ', $line, 2);
$headers[$name] = $value;
}
return $headers;
} |
_________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|