Jump to content

file_get_contents question


www.mihalism.com
 Share

Recommended Posts

You'll need to have access to the server logs. There, search for any file that's accessed by the user agent "PHP". Adresses that have used this user agents are actually the servers containing the files that fetched your content.Getting the name of the exact file is not possible though. Not like this anyway. Also, note that the user agent string "PHP" could be edited if the client has access to the php.ini of their server.

Link to comment
Share on other sites

If you want to get the IP or domain name of the client, the IP is in $_SERVER['REMOTE_ADDR']. If you want to get the domain name, you can do a reverse DNS lookup on the IP address, PHP has this function to do that:http://www.php.net/manual/en/function.gethostbyaddr.phpThat will get the host name that corresponds with the IP. For the vast majority of requests that will correspond to the hostname from the ISP. Even where I'm working now, we have a web server with a static IP and a domain name, but if I am browsing a website from the office the IP that my request comes in on is not the same as the web server IP, so the reverse DNS lookup on my IP would get information about the fact that our ISP is Echelon, it wouldn't tell you what the domain name of our web server is. That would only happen if the web server itself sends the request out.This holds true for all requests. You cannot reliably distinguish any set of requests, for example you can't check the logs for everyone using Firefox (or PHP sending requests, or whatever) and be sure that you got 100% of the events with 0% chance of false positives. You can estimate that type of thing, but the client can send whatever user agent string it wants, I can have my browser send my first and last name as the user agent string and you can't tell which browser I'm using, which OS, if it is PHP or not. You can guess, but that's about it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...