HOW TO RETRIEVE A VISITOR'S IP ADDRESS

4 visualizaciones (últimos 30 días)
mohammad ibrahim
mohammad ibrahim el 1 de Ag. de 2021
Respondida: Hari el 13 de Nov. de 2024 a las 3:08
How can I retrieve the IP address of visitors to my web app using MATLAB ?
for example in .NET, we can use:
public string IpAddress()
{ string strIpAddress; strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (strIpAddress == null)
{ strIpAddress = Request.ServerVariables["REMOTE_ADDR"]; }
return strIpAddress; }
thank you

Respuestas (1)

Hari
Hari el 13 de Nov. de 2024 a las 3:08
Hi mohammad,
I understand that you want to retrieve the IP address of visitors to your web application using MATLAB, similar to how it's done in .NET.
I assume you have a MATLAB-based web application, possibly using MATLAB Web App Server or MATLAB Production Server.
Here are some of the way you can try out.
  1. Use MATLAB Web App Server: If you're using MATLAB Web App Server, you can access request headers to retrieve the IP address. However, direct access to server variables like in .NET is not available in MATLAB. You might need to handle this on the server side using a proxy or middleware to pass the IP address to your MATLAB code.
  2. Capture IP Address via Middleware: Implement a middleware layer in your web server (like Apache or Nginx) to capture the IP address and pass it as a parameter to your MATLAB function. This approach requires configuring your server to include the IP address in requests to MATLAB.
  3. Use MATLAB Production Server: If using MATLAB Production Server, you can configure request handling to include custom headers with the IP address. This involves setting up your server to capture and forward the IP address to your MATLAB function.
Refer to the documentation of MATLAB Web App Server for deployment details: https://www.mathworks.com/help/webappserver/
Refer to the documentation of MATLAB Production Server for request handling: https://www.mathworks.com/help/mps/
Hope this helps!

Categorías

Más información sobre Call Web Services from MATLAB Using HTTP en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by