HTTP_RESPONSE_HEADER(3) 1 HTTP_RESPONSE_HEADER(3)
$http_response_header - HTTP response headers
The $http_response_header array is similar to the get_headers(3) function. When using the HTTP wrapper, $http_response_header will be pop-
ulated with the HTTP response headers. $http_response_header will be created in the local scope.
Example #1
$http_response_header example
<?php
function get_contents() {
file_get_contents("http://example.com");
var_dump($http_response_header);
}
get_contents();
var_dump($http_response_header);
?>
The above example will output something similar to:
array(9) {
[0]=>
string(15) "HTTP/1.1 200 OK"
[1]=>
string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT"
[2]=>
string(29) "Server: Apache/2.2.3 (CentOS)"
[3]=>
string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT"
[4]=>
string(27) "ETag: "280100-1b6-80bfd280""
[5]=>
string(20) "Accept-Ranges: bytes"
[6]=>
string(19) "Content-Length: 438"
[7]=>
string(17) "Connection: close"
[8]=>
string(38) "Content-Type: text/html; charset=UTF-8"
}
NULL
PHP Documentation Group HTTP_RESPONSE_HEADER(3)
Check Out this Related Man Page
HTTP_PARSE_MESSAGE(3) 1 HTTP_PARSE_MESSAGE(3)http_parse_message - Parse HTTP messagesSYNOPSIS
object http_parse_message (string $message)
DESCRIPTION
Parses the HTTP $message into a simple recursive object.
PARAMETERS
o $message
- string containing a single HTTP message or several consecutive HTTP messages
RETURN VALUES
Returns a hierarchical object structure of the parsed messages.
EXAMPLES
Example #1
Using http_parse_message(3)
<?php
define ('URL', 'http://www.example.com/');
print_r(http_parse_message(http_get(URL, array('redirect' => 3))));
?>
The above example will output something similar to:
stdClass object
(
[type] => 2
[httpVersion] => 1.1
[responseCode] => 200
[headers] => Array
(
[Content-Length] => 3
[Server] => Apache
)
[body] => Hi!
[parentMessage] => stdClass object
(
[type] => 2
[httpVersion] => 1.1
[responseCode] => 302
[headers] => Array
(
[Content-Length] => 0
[Location] => ...
)
[body] =>
[parentMessage] => ...
)
)
SEE ALSO http_parse_headers(3), the HttpMessage class.
PHP Documentation Group HTTP_PARSE_MESSAGE(3)
I have a text file which represents a http flow like this:
HTTP/1.1 200 OK
Date: Fri, 23 Jan 2009 17:16:24 GMT
Server: Apache
Last-Modified: Fri, 23 Jan 2009 17:08:03 GMT
Accept-Ranges: bytes
Cache-Control: max-age=540
Expires: Fri, 23 Jan 2009 17:21:31 GMT
Vary: Accept-Encoding ... (1 Reply)
Hi Friends,
I have the below text in a file outbound.tmp
HTTP/1.1 200 OK
Date: Tue, 22 Jun 2010 19:34:09 GMT
RC: 0
Content-Type: text/html
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
I need to extract the value next to the word - RC.
Example:
RC: 0 ... (8 Replies)
Hi,
I have installed VirtualBox, downloaded CentOS 5.5 and created a VirtualMachine where i have installed the 'server' versión of CentOS 5.5
As I installed Virtual Box a new network device appeared '192.16.1.250' in my 'real' machine. I was unable to reach my webserver so i istalled CentOS once... (5 Replies)
#!/bin/bash
timevar=`date +%d-%m-%Y_%H.%M.%S` #-- > Storing Date and Time in a Variable
get_contents=`cat urls.txt` #-- > Getting content of website from file. Note the file should not contain any http:// as its already been taken care of
echo "Datae-time URL Status code Report" >... (2 Replies)
Hi All,
I would like to install CentOS 5.5 linux on Power7 server (P750).
it support or not??
I found information from IBM websites as detail below, but not sure for CentOS.
IBM Power 750 support linux >>Red Hat Enterprise Linux 5.5, SUSE Linux Enterprise Server 10 SP3,... (2 Replies)
Hi Guys,
I really don't know where to put my query about this. And as a newbie, I think CentOS is closest to Ubuntu. Anyway, here's my dilemma. I have installed a VMWare - ESX 3.5 and installed CentOS 6 and cloned the CentOS 6. The first CentOS was working fine, when i cloned it, and the cloning... (2 Replies)
I want to check if the string is WINDOWS-1251 or UTF-8
can you help me to find the string encoding???
or maybe to get URL Content-Type charset with wget?
this is my function on PHP
function check_utf8($str) {
$len = strlen($str);
for($i = 0; $i < $len; $i++){
$c =... (2 Replies)
Hi there if I have a file called an411
which contains the folowing information
152.78.74.111 "GET /datafeed.php HTTP/1.1" 200 2826
152.78.74.211 "GET /index.html HTTP/1.1" 200 1190
152.78.74.121 "GET / HTTP/1.1" 200 3000
and I want to ouput the number of bytes of the record that contains... (2 Replies)
I did an upgrade on Jan 3,2014 from CentOS 6.4 to 6.5 and noticed that there hasnt been any updates since then
Jan 03 11:45:05 Updated: 12:dhcp-common-4.1.1-38.P1.el6.centos.i686
Jan 03 11:45:06 Updated: hwdata-0.233-9.1.el6.noarch
Jan 03 11:45:11 Updated:... (4 Replies)
I want to grep/awk /var/log/httpd/mysite-access_log.log and check if 2 words from the following appear in a single line:
benchmark
union
information_schema
drop
truncate
group_concat
into
file
case
hex
lpad
group
order
having
insert
union
select
from (12 Replies)