HEADER_REGISTER_CALLBACK(3) 1 HEADER_REGISTER_CALLBACK(3)header_register_callback - Call a header functionSYNOPSIS
bool header_register_callback (callable $callback)
DESCRIPTION
Registers a function that will be called when PHP starts sending output.
The $callback is executed just after PHP prepares all headers to be sent, and before any other output is sent, creating a window to manip-
ulate the outgoing headers before being sent.
PARAMETERS
o $callback
- Function called just before the headers are sent. It gets no parameters and the return value is ignored.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
header_register_callback(3) example
<?php
header('Content-Type: text/plain');
header('X-Test: foo');
function foo() {
foreach (headers_list() as $header) {
if (strpos($header, 'X-Powered-By:') !== false) {
header_remove('X-Powered-By');
}
header_remove('X-Test');
}
}
$result = header_register_callback('foo');
echo "a";
?>
The above example will output something similar to:
Content-Type: text/plain
a
NOTES header_register_callback(3) is executed just as the headers are about to be sent out, so any output from this function can break output.
Note
Headers will only be accessible and output when a SAPI that supports them is in use.
SEE ALSO headers_list(3), header_remove(3), header(3).
PHP Documentation Group HEADER_REGISTER_CALLBACK(3)
Check Out this Related Man Page
APACHE_RESPONSE_HEADERS(3) 1 APACHE_RESPONSE_HEADERS(3)apache_response_headers - Fetch all HTTP response headersSYNOPSIS
array apache_response_headers (void )
DESCRIPTION
Fetch all HTTP response headers.
RETURN VALUES
An array of all Apache response headers on success or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.5.7 | |
| | |
| | This function became available in the CLI |
| | server. |
| | |
| 5.4.0 | |
| | |
| | This function became available under FastCGI. |
| | Previously, it was supported when PHP was |
| | installed as an Apache module or by the NSAPI |
| | server module in Netscape/iPlanet/SunONE web- |
| | servers. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
apache_response_headers(3) example
<?php
print_r(apache_response_headers());
?>
The above example will output something similar to:
Array
(
[Accept-Ranges] => bytes
[X-Powered-By] => PHP/4.3.8
)
SEE ALSO apache_request_headers(3), headers_sent(3), headers_list(3).
PHP Documentation Group APACHE_RESPONSE_HEADERS(3)
Man Page
8 More Discussions You Might Find Interesting
1. Post Here to Contact Site Administrators and Moderators
Hi,
I am new to Unix (AIX).
I have a header (in a text file) that needs to be wrtitten on all the pages of a result file (text file). After the header is written, data needs to be read from a file A(text file) and inserted to the result file. If the number of lines reaches 80 in a page, page... (1 Reply)
Hi all
Can anyone suggest me a good solution ? My requirement is as follows
I have a plain text file similar to this...
sending data to 0003345234
here is the output...
,..........
...........
.......
sending data to 00033452ab
here is the output...
,..........
...........
.... (5 Replies)
hi, i want to ask, how to make a plain text database (u need to call and search all the data manually) in PHP. i am going to apply it in UNIX os. anyone have any idea how to do it? most of the data only using mysql while i am forbid to do so. (2 Replies)
Hi ,
I have a .txt file in which I have multiple headers, the header record starts with $ symbol...like the first column name is $Account.
I have to keep the header in the first line and delete all the remaining headers which are in the file.
I tried using sort adc.txt | uniq -u , but my... (7 Replies)
Hi,
I have catenated multiple output files (from a monte carlo run) into one big output file. Each individual file has it's own two line header. So when I catenate, there are multiple two line headers (of the same wording) within the big file. How do I use the sed command to search for the... (1 Reply)
I have a file called "dsout" with empty rows and duplicate headers.
DATE TIME TOTAL_GB USED_GB %USED
--------- -------- ---------- ---------- ----------
03/05/013 12:34 PM 3151.24316 2331.56653 73.988785 ... (3 Replies)
I have several las files with a header and each file start Version and text and before the data starts end up with ~Ascii, then the numbers starts:
-------------------------------------------------------------------------
~Version
.....text....
~Ascii
2 abc 230 1 name
1 abc 400 1... (17 Replies)