Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to get IP address of other server

rajiv_turkarrajiv_turkar Posts: 32Member
Hello All,
I am working on shopping cart..I want to know the IP address of the other server...
If someone searched my product from google and then he comes to my site..I want to know the IP address of google..The search engine may be anyone..How to accomplish this task...Please help me
rajiv

Comments

  • DarQDarQ Posts: 1,625Member
    [red]
    $_SERVER['REMOTE_ADDR']
    [/red]

    : Hello All,
    : I am working on shopping cart..I want to know the IP address of the other server...
    : If someone searched my product from google and then he comes to my site..I want to know the IP address of google..The search engine may be anyone..How to accomplish this task...Please help me
    : rajiv
    :

    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    url--> http://mark.space.servehttp.com

  • Johnny13Johnny13 Posts: 128Member
    : I want to know the IP address of the other server...
    I think you're looking for [purple]$ip=gethostbyname("");[/purple]
    yup,RTFM as they said :P
  • DarQDarQ Posts: 1,625Member
    [b][red]This message was edited by Moderator at 2003-12-25 6:26:22[/red][/b][hr]
    : : I want to know the IP address of the other server...
    : I think you're looking for [purple]$ip=gethostbyname("");[/purple]
    : yup,RTFM as they said :P
    :
    no, gethostbyname is similar to the *nix function host IPADDRESS

    see:
    http://php.net/manual/function.gethostbyname.php

    you would need the hostname to get the IP. what's below is simpler, faster and easier ;-)

    the REAL IP comes with $_SERVER['REMOTE_ADDR']
    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    url--> http://mark.space.servehttp.com





  • rajiv_turkarrajiv_turkar Posts: 32Member
    Hello all,
    The things which u told is not solving my problem...My problem is that if someone comes to my site by using search engines like google or else...I want to know the IP address or host name of that search engine....Now i think that u understand my problem...Is there any facility in PHP to do this...Thanks 4 ur reply...
    Rajiv
  • netgertnetgert Posts: 331Member
    [b][red]This message was edited by netgert at 2003-12-26 2:52:26[/red][/b][hr]
    : [red]
    : $_SERVER['REMOTE_ADDR']
    : [/red]

    Doesn't this return the address of the client? I think the thing that should be looked for is "referrer". Most browsers send a referrer-header with URL of previous page. You can extract the host name of that URL and resolve it to IP address.

    'REMOTE_ADDR'
    The IP address from which the user is viewing the current page.

    'HTTP_REFERER'
    The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

    Try this:
    [code]
    $url = parse_url($_SERVER["HTTP_REFERER"]);
    $ip = gethostbyname($url["host"]);
    [/code]

    :
    : : Hello All,
    : : I am working on shopping cart..I want to know the IP address of the other server...
    : : If someone searched my product from google and then he comes to my site..I want to know the IP address of google..The search engine may be anyone..How to accomplish this task...Please help me
    : : rajiv
    : :
    :
    : [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    : url--> http://mark.space.servehttp.com
    :
    :

    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]



  • Johnny13Johnny13 Posts: 128Member
    so the answer is [purple]216.239.57.99[/purple]?
  • netgertnetgert Posts: 331Member
    : so the answer is [purple]216.239.57.99[/purple]?
    :
    [code]Pinging google.com [216.239.57.99] with 32 bytes of data:[/code]
    Yep, it's google!

    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • MaxLeeMaxLee Posts: 18Member
    : [red]
    : $_SERVER['REMOTE_ADDR']
    : [/red]
    :
    : : Hello All,
    : : I am working on shopping cart..I want to know the IP address of the other server...
    : : If someone searched my product from google and then he comes to my site..I want to know the IP address of google..The search engine may be anyone..How to accomplish this task...Please help me
    : : rajiv
    : :
    :
    : [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    : url--> http://mark.space.servehttp.com
    :
    :


    I just happen browse this thread and find the $_SERVER['REMOTE_ADDR'],it is helpful,

    thx a lot.

  • DarQDarQ Posts: 1,625Member
    : : [red]
    : : $_SERVER['REMOTE_ADDR']
    : : [/red]
    : :
    : : : Hello All,
    : : : I am working on shopping cart..I want to know the IP address of the other server...
    : : : If someone searched my product from google and then he comes to my site..I want to know the IP address of google..The search engine may be anyone..How to accomplish this task...Please help me
    : : : rajiv
    : : :
    : :
    : : [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    : : url--> http://mark.space.servehttp.com
    : :
    : :
    :
    :
    : I just happen browse this thread and find the $_SERVER['REMOTE_ADDR'],it is helpful,
    :
    : thx a lot.
    [red]
    and that you may use it wisely ;-)
    [/red]
    :

    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    NEW url--> http://mark.space.servehttp.com

Sign In or Register to comment.