php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34058 get_headers() retrieve a particular respons
Submitted: 2005-08-10 02:42 UTC Modified: 2015-03-27 14:19 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: bjori@php.net Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5CVS-2005-08-10 (dev) OS:
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: bjori@php.net
New email:
PHP Version: OS:

 

 [2005-08-10 02:42 UTC] bjori@php.net
Description:
------------
Any change we can make get_headers() to act like parse_url(), i.e. retrive a particular respons (see: http://news.php.net/php.cvs/33239)?

Reproduce code:
---------------
<?php
 $last_modified = get_headers("http://example.com", 1, "Last-Modified");
 echo $last_modified;
?>

Expected result:
----------------
Wed, 08 Jan 2003 23:11:55 GMT


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-11 03:56 UTC] arnar at 8 dot is
Patch has been submitted to php.internals

http://news.php.net/php.internals/17815

Arnar Mar Sig
 [2013-10-29 07:46 UTC] krakjoe@php.net
-Package: Feature/Change Request +Package: *General Issues
 [2013-10-29 07:46 UTC] krakjoe@php.net
There's an impl attached ...

Something to think about maybe ... if a server sends multiple headers of the same name you will only get the first returned, if we want to return a string there's not really another (good) way.
 [2015-03-27 14:19 UTC] tyrael@php.net
-Status: Open +Status: Wont fix
 [2015-03-27 14:19 UTC] tyrael@php.net
I don't think it has much need now that we have array dereferencing:
$last_modified = get_headers("http://example.com", 1)["Last-Modified"];
echo $last_modified;

(hi Hannes! :P)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 17:01:33 2025 UTC