Results 1 to 3 of 3

Thread: Getting at headers when requesting a URL

  1. #1

    Thread Starter
    Addicted Member mralston's Avatar
    Join Date
    Aug 2002
    Location
    Altrincham Nr Manchester, England
    Posts
    141

    Getting at headers when requesting a URL

    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?)

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    what headers do you plan on getting?

    when you fetch a url with fopen you get the page as you would see it on the website. I don't believe you get any headers as you didn't output it to anything. also popen I also believe will not open url's

  3. #3

    Thread Starter
    Addicted Member mralston's Avatar
    Join Date
    Aug 2002
    Location
    Altrincham Nr Manchester, England
    Posts
    141
    It's ok, I've figured out how to do it. Forgot to close this thread.
    I was after the "Location" header.

    I had it in my head that popen was short for "port open". The function I was actually after was fsockopen to open a raw socket to the server and manually send and receive the necessary headers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width