Hello All,

Is there a way to print the http header? I want to print realm parameter from the header.

Regards,

Hello All,

Is there a way to print the http header? I want to print realm parameter from the header.

Regards,

Hello,

as large parts of the HTTP-Header are generated by the Web-Server after PHP has finished its job, there is no real easy way to do this on the server end. A tool commonly used for that purpose (if you are about debugging) is FireBug, which is a PlugIn for the Firefox web browser. This has this feature (and many more).

Member Avatar for diafol

.... FireBug, which is a PlugIn for the Firefox web browser ....

Yep - also live http headers (Firefox).

Can I ask why you'd want to print them?

Hi Guys,

Thanx for your replies, I just want to print realm attribute, is there a way to print it inside a script.

The script I want to make to check wireless bullets on/off and the host name (bullet name) but the factory registered the host name in the header inside realm attribute.

Hope you got a hint.

Regards,

Member Avatar for diafol

Does the info you want turn up in the $_SERVER superglobal?

Hi Guys,

Thanx for your replies, I just want to print realm attribute, is there a way to print it inside a script.

The script I want to make to check wireless bullets on/off and the host name (bullet name) but the factory registered the host name in the header inside realm attribute.

Hope you got a hint.

Regards,

This sounds pretty much like two "servers" are involved. What I am guessing from your description is that you have a web server A connecting to a router (which has a built-in web server B). This scenario is quite different from the original assumption. In this case web server A is acting as a web client towards the router (web server B). In this scenario, you could use the CURL PHP extension to connect to the router and then indeed, you would get all the headers. The CURL extension is described in detail in the PHP documentation. It pretty much resembles to 6 or 7 commands:

$weblink = curl_init("http://your-router/whatever.url");
curl_setopt($weblink, CURLOPT_HEADER, 1); // tell PHP you want to grab headers as well
ob_start(); // turn on output buffering, so you can grab the stuff in a variable
curl_exec(); // this will dump the output data from the URL
$buffer = ob_get_contents(); // put everything into a buffer variable
ob_end_clean(); // turn output buffering off and clean it
curl_close(); // free up the CURL resources

After that piece of code you would see everything returned from the router in the variable $buffer and you could process that as you like. The might be some more curl_setopt statements needed, depending on the counterpart web server B. You can for example set options for username and password.

maba thanx for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.