Jump to content

getting IP address


jwilson122

Recommended Posts

Okay, so I know how to get an IP address using $_SERVER['REMOTE_ADDR'], however, I need to get an IP a little different. How would I get the IP of the visitor on a remote site loading MY site using file_get_contents()? It just returns that remote websites server IP... :/

 

Thanks!

Link to comment
Share on other sites

Client makes HTTP request to server A via browser, server A makes HTTP request to server B via file_get_contents().  There is nothing in common between the two.

 

Well, see I'm trying to get HTTP_X_FORWARDED_FOR and those types of HTTP's from the website using the file_get_contents().. :/ Cant do that no way possible?

Link to comment
Share on other sites

a file_get_contents call via a php script ... triggered by a client-user running the php page.. will not show any footprints from the client. 

 

server a hosts page a.

server b hosts page b.

 

page a does a file_get_contents to snag page b from server b.

 

user c goes to page a on server a.

page a gets the contents of page b.

 

server b will get footprint info from server a, since server a is the content getter.  essentially, in this relationship, server a is the client of server b's page.  also, with curl, these variables can all be hacked, so from server b's perspective (the one which you are asking about), the only reliable data is the IP of where the request is coming from.    that can be done through a proxy so it doesn't lead back to server a.  IP can be spoofed, but it is pointless, because the data from the file_get_contents or curl call would be sent to the spoofed IP, not to the spoofer.

 

you can lock down your content if you are concerned about screen scrapes and vultures through a combination of various methods (HTTACCESS etc).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.