问题
I want to get The IP Address of user who sent a request to my server using cURL POST method in php ?
I'm developing a Flight API, I'll get the Requests using cURL POST method, I've to get the IP address of the client and validate weather his IP address is available or not. If available in my DB i will sent him the response by JSON.
Is it possible anyway in php ?
回答1:
You can get the request IP address from server variable.
$_SERVER["REMOTE_ADDR"]
来源:https://stackoverflow.com/questions/16556208/getting-ip-address-of-a-user-who-sent-a-curl-request