fopen() and getting the headers that are sent from a file...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
superwormy
Forum Commoner
Posts: 67
Joined: Fri Oct 04, 2002 9:25 am
Location: CT

fopen() and getting the headers that are sent from a file...

Post by superwormy »

Is there a way to request a remote page ( ie http://www.domainname.com ) and get all the headers that page sends back to the browser?

I want to see what its sending for headers, what cookies and such.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

View > Source :D
www.domainname.com wrote: <HEAD>
<TITLE>DomainName.com -- Reserve Your Place In Cyber Space with DomainName.com Domain Name Registration Services!</TITLE>
<META NAME="description" VALUE="Register your own Internet Domain Name in three easy steps and for just pennies a day!">
<META NAME="keywords" CONTENT=".com, .net, .org, DNS whois, DomainName.com, InterNIC, NIC, TLD, URL registration, business names, getting checking a domain name, company registration, corporate names, custom URL, custom domains, domain hosting, domain name, domain name application, domain name check, domain name registrar, domain name registration, domain name search, domain name service, domain name parking, domain transfer, domain names, domain registration, domain space, domains, e-mail, email, hosting, how to buy register a domain name, internet names, low cost hosting, name registration, name transfer, net names, new domain name, new domains, presence provider, register a domain, register domain name, registering a domain name, search, trademarks, transfer a domain, transfering a domain name, unique name, virtual domains, virtual hosting, web hosting, web names, web servers, web site hosting, web sites, web space hosting, web space provider, web-space, web-space hosting, webspace provider, where to buy a domain name, www">
<!-- .com, .net, .org, DNS whois, DomainName.com, InterNIC, NIC, TLD, URL registration, business names, getting checking a domain name, company registration, corporate names, custom URL, custom domains, domain hosting, domain name, domain name application, domain name check, domain name registrar, domain name registration, domain name search, domain name service, domain name parking, domain transfer, domain names, domain registration, domain space, domains, e-mail, email, hosting, how to buy register a domain name, internet names, low cost hosting, name registration, name transfer, net names, new domain name, new domains, presence provider, register a domain, register domain name, registering a domain name, search, trademarks, transfer a domain, transfering a domain name, unique name, virtual domains, virtual hosting, web hosting, web names, web servers, web site hosting, web sites, web space hosting, web space provider, web-space, web-space hosting, webspace provider, where to buy a domain name, www -->
<SCRIPT LANGUAGE="JavaScript">
<!--
NS4 = (document.layers);
IE4 = (document.all);
Ver4 = (NS4 || IE4);
isMac = (navigator.appVersion.indexOf("Mac") != -1);
isWin = (navigator.appVersion.indexOf("Win") != -1);
var pics;
var Images=false;
// -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.1">
<!--
Images = (document.images);
pics = new Array();
// -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function rollover(Name, ID, How){
if (Images) {
document.images[Name].src=pics[ID][How].src;
}
}
function preload(ID, Key) { // ID is a name...
if (Images) {
pics[ID] = new Array(3);
pics[ID][0] = new Image();
pics[ID][0].src = "/V2.5/Images/"+Key+"U.gif";
pics[ID][1] = new Image();
pics[ID][1].src = "/V2.5/Images/"+Key+"R.gif";
pics[ID][2] = ID;
}
}
//-->
</SCRIPT>


</HEAD>
Unless they send you the script, i doubt you can see what cookies are being sent, unless you delete all of yours and visit the page, then check your 'Cookies' folder in the 'Windows' directory (Win 9x + Me & 2K) on your HD.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

he/she probably meant http-header which are outside the html-document (loaddata) and not shown in view source.
I'm looking for something like this, too, and my attempts to write a plugin for IE that could do it -hmm, in short terms- failed ;)
superwormy
Forum Commoner
Posts: 67
Joined: Fri Oct 04, 2002 9:25 am
Location: CT

Post by superwormy »

Correct, I know I can fricking view the source sheesh.

I want to view the HEADERS, the HTTP-HEADERS that a page returns. Like this:

http://www.iisfaq.com/default.asp?View=L1315&P=121


Only do it with PHP!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http-requests are quite simple. afaik fopen-url-wrapper will eat all headers and only return the document data.
But with socket-support you may create your own request.
Then you have access to the headers - of course ;)
e.g. take a look at http://snoopy.sourceforge.net/
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

that will give you all headers that have been sent by the client not those that are sent by the server when you create a new request from within a php-script ;)
Post Reply