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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: csnaitsirch at web dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 19:01:35 2025 UTC