Question
Surya Prakash · Jun 15, 2021

Getting Users ip and location

 My requirement is to get the website visitors IP address and location. I tried an external API . Always it's returning server IP and location not visitors IP.  

set req=##class(%Net.HttpRequest).%New()
  set req.Server="api.ipstack.com"
  set req.ContentType="application/json"                                           
  set sc=req.Get("/check?access_key= key here")
  set data=req.HttpResponse.Data
  
 Write data.Read(30000)

Can someone help me to resolve this issue? or any in-build method is there in Iris to get the IP.

Have to create a production operation and service for this?

Product version: IRIS 2020.1
0
0 172
Discussion (3)1
Log in or sign up to continue

maybe a misunderstanding.

if you execute a HTTP request YOU are the visitor at that side and get a response.
do you look for your own IP address? 

Hi Robert,

No. I want to know the location and IP of users who are all opening my website. Any in-built methods to do this or any external API? Guide me.

Thanks for your reply.

the base class for all Webpages (also REST) from IRIS is %CSP.Page.cls
When a csp request is received, the CSP Server creates an instance of the %CSP.Request class. This is accessible via the %request variable. It holds all information about the call.
Also all CGI variables.  HTTP_REFERER might be what you look for
and that's all core HTTP