Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What does the HOST refer to in the header section of a request?

    Hi, when I use fsockopen, I should enter the URL or the IP of the server that I want to open.

    Something like this:
    Code:
    $fp = fsockopen("$URL", 80);
    After openning the connection, I need to make a request. The request is something like this:

    Code:
    $Request = "GET /index.html HTTP/1.0\r\n" .
    	   "HOST: www.ASite.com\r\n\r\n";
    So, here is my question: What does this HOST mean in our request?
    Is this the URL of the server that we are connectiong to ( in this case it should be $URL ), or is it the URL that we're comming from? Because as we know we can use $HTTP_SERVER_VARS["REMOTE_ADDR"] in a page to get the IP of the viewer. So, by requesting a page in this way, we should somehow tell the responding server where we are comming from; maybe they're using the same way to get the URL that redirected us to their page. But if it's not, how could the responding server find out our IP or URL that redirected us to it?

    PS. I checked it out by changing the HOST value to something different with $URL ( as you see ), then I made the script to read a php file that output $HTTP_SERVER_VARS["REMOTE_ADDR"], I expected that this php file shows me "www.ASite.com" ( the thing that I put in my request ), but instead it showed the url that I used in fsockopen ($URL). If it be like this, then the webmaster at the responding server never finds out where we are comming from!

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,045
    Thanks
    10
    Thanked 93 Times in 91 Posts
    You can put any URL you like as the HOST
    but if the script at the other end validates the referer you will need it, but even yak@yak.com should work.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So, you're saying that it is the variable that will make the $_SERVER["REFERER"], right? It means that if I put something like yak@yak.com, then a script at the other end wants to find out where I'm comming from, it'll show yak@yak.com as the referer? So, we can fake a website like this, am I right?


  •  

    Posting Permissions

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