php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47195 Class for easier sending HTTP Headers
Submitted: 2009-01-23 09:04 UTC Modified: 2009-01-23 09:11 UTC
From: csnaitsirch at web dot de Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.2.8 OS: Debian/Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-01-23 09:04 UTC] csnaitsirch at web dot de
Description:
------------
In my opinion it is difficult to send special HTTP headers.
If you create a File programaticly and want to send it to the user, you have to use something like:

<?php
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"file.csv\"");
header("Content-Length: ".strlen($csv));
?>

So I have written some classes to make it easier.
The same result of the upper example will be reached with the following:

<?php
$h = new HTTPHeader();
$h->ContentType()->ApplicationOctetStream();
$h->ContentDisposition()->Attachment()->Filename("file.csv");
$h->ContentLength($csv);
?>

If you think it would be a helpful class mail me.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-23 09:11 UTC] pajoye@php.net
Take a look at http://pecl.php.net/http
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 11:01:32 2024 UTC