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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
39 + 22 = ?
Subscribe to this entry?

 
 [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 18 08:01:33 2024 UTC