Re: Improvements to HTTP stream metadata
| From: | Stas Malyshev | Date: | Thu, 30 Jun 2011 21:29:41 +0000 |
| Subject: | Re: Improvements to HTTP stream metadata | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53709@lists.php.net to get a copy of this message | ||
Hi!
On 6/30/11 1:44 PM, Michael Maclean wrote:
Hi, Currently, if you open an HTTP stream using fopen(), and then call stream_get_meta_data() on it, you obtain an associative array within which as another with the key 'wrapper_data'. Inside that, there is a list of the HTTP headers from the server response. I'd like to make this a little more useful as currently I don't believe there's a way to get the response code from the remote end without parsing those headers yourself. While this isn't hard, I'd like to make the following changes: * move the current contents of the wrapper_data array to a key called 'headers' within wrapper_data;This means breaking every script in existence that uses this data now. Probably not a good idea. Maybe we should think about a BC way to do the same.
* Add a 'response_code' key, with the server response code as an integer * Optionally, add things like the mime type of the response. Anyone got any thoughts on this? I appreciate it'd be a BC break, but I think it might be useful.-- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227