0

What I want to do is receive client info like his IP address & useragent ..etc, on "client.php" and display it on real time in second page "admin.php" (Client to client)

I know this is easy with database but I don't want to store anything, just display it on my side in real time until the client close the page

I searched a lot, but only found "client to server data sending" or "server to client", While I'm looking for a way to make it "client to client"

Farouk
  • 23
  • 1
  • 6
  • Well you've already tagged websockets, so what exactly is your question? If you know about websockets then you already know the technology you need in order to implement your requirement. – ADyson Jul 14 '21 at 10:40
  • I couldn't find the right source code to do it with websockets – Farouk Jul 14 '21 at 10:55
  • You'll need to be a bit more specific than that. We're not a tutorial service and we're not a substitute for research. What exactly have you attempted and what problem are you facing, precisely? See [ask] for more guidance. – ADyson Jul 14 '21 at 11:04
  • It seems more difficult than I thought thanks for your comment! – Farouk Jul 14 '21 at 11:25
  • 1
    Sorry to hear you're finding it tricky. But unless you provide some info about your attempt and your exact issue(s) we can't really help you. There are lots of websockets examples and tutorials available, so we're not going to just repeat those, you need to give us something more about your problem to work with. – ADyson Jul 14 '21 at 12:05
  • Actually I was trying to build my own simple visitor tracking system like Google analytics or Histats, just get visitors ip and display it for me I searched for ways to do this with php but I found that it's not possible with php only but, with `websocket ` or `socket.io` and I don't have any information about them – Farouk Jul 14 '21 at 15:50
  • `I don't have any information about them`...well there's plenty of information about them available on the internet, so it's not clear why you don't have any information. Or maybe you feel like you don't understand some specific concept about them? We don't really know, you still haven't identified a real problem we could help with. To be clear, stackoverflow is not a free do-my-research service. – ADyson Jul 14 '21 at 15:53
  • P.S. PHP is perfectly capable of detecting the visitor's public IP address, so I've no idea why you think that's impossible, or how you expect that a websocket would help you with such a task. https://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php is the standard stackoverflow answer for the question "How to get the client IP address in PHP". – ADyson Jul 14 '21 at 15:54
  • My problem is that I don't know anything about websocket technology, I tried to learn it but found myself with endless other problems ): – Farouk Jul 14 '21 at 16:19
  • `My problem is that I don't know anything about websocket technology`...then you need to go and learn about the main concepts. Come back here if you have a more specific, tangible problem. Like I said, we don't provide (or recommend) generic tutorials or undertake research on your behalf. But as per my last comment, I don't think you even need websockets at all if you just want to detect the user's IP address. Are you actually reading my comments and understanding them? Because we seem to be going round in circles – ADyson Jul 14 '21 at 16:30
  • However if you want to do the real-time thing that _would_ be a use case for websockets in general (regardless of the specific data you're sending), but that doesn't seem especially necessary for an analytics system, which is generally all about analysing data captured over a longer period of time. If you want some sort of real-time monitoring for debugging or error management then that's a different use case. – ADyson Jul 14 '21 at 16:54
  • `Are you actually reading my comments and understanding them?` to detect the user's IP address i'm using `$_SERVER["REMOTE_ADDR"]` , `I don't think you even need websockets at all` Did you read my entire question? – Farouk Jul 14 '21 at 17:12
  • Yes, see my later comment regarding real-time. `to detect the user's IP address i'm using $_SERVER["REMOTE_ADDR"] ,`...ah good. Because earlier in these comments you claimed that was impossible and then said that was your justification for using websockets (which made no sense) – ADyson Jul 14 '21 at 17:29
  • It seems you didn't understand my comments well I said it's impossible with php only, which means you can't send data in real time from `client to another` using php – Farouk Jul 14 '21 at 17:36
  • No well what your comment actually said (or appeared to say) was that it was impossible to get the IP address using PHP...that comment never mentioned real time, it just talked about IP address. So that's what I thought you meant. What you actually wrote was `just get visitors ip and display it for me I searched for ways to do this with php but I found that it's not possible with php` – ADyson Jul 14 '21 at 17:46

0 Answers0