Getting at headers when requesting a URL

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
mralston
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Oct 29, 2002 3:47 am
Location: Altrincham, Cheshire, England
Contact:

Getting at headers when requesting a URL

Postby mralston » Sun Nov 10, 2002 4:22 pm

I want to fetch a URL in PHP with fopen or popen or something.
Getting the main content of the page is fine, but I want to access the headers that the server sends back with the page. I'm sure it can be done with popen (or some command to open a tcp/ip connection to port 80?)

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sun Nov 10, 2002 9:52 pm

it is imposible...

you just can view a result of the fopen function work...

User avatar
mralston
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Oct 29, 2002 3:47 am
Location: Altrincham, Cheshire, England
Contact:

Postby mralston » Mon Nov 11, 2002 4:03 am

Actually it is possible. Somebody else just gave me the answer. fsockopen does the trick. But thanks anyway. :wink:

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Postby WiZARD » Mon Nov 11, 2002 5:16 am

mralston wrote:Actually it is possible. Somebody else just gave me the answer. fsockopen does the trick. But thanks anyway. :wink:

You mean get info from server like type of Broowser, IP, etc?

User avatar
mralston
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Oct 29, 2002 3:47 am
Location: Altrincham, Cheshire, England
Contact:

Postby mralston » Mon Nov 11, 2002 5:40 am

That's the ticket. In this case I was after the "Location" header - the page I'm requesting is a 301-page-moved redirect page. I've got it working now. :)


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron