1

I'm dealing with Flight Search API for my clients. I want to restrict some client requests from some IP Address who didn't registered with me. All the IP Addresses of my clients I will save them in a DB.

Now a user sent me a RAW HTTP POST jSON data to my server.

How do i get the IP address of that client who sent me a RAW HTTP POST JSON Data ?

Is it possible in cURL ? or give me some suggestions.

Thanks in advance.

2 Answers2

4

Use $_SERVER['REMOTE_ADDR'] for the ip address of the requestor

This is totally unrelated from curl... so use this when curl is used and a request is done to your php where you are about to process the request done by curl

nl-x
  • 11,762
  • 7
  • 33
  • 61
0
echo $_SERVER['REMOTE_ADDR'];

http://php.net/manual/en/reserved.variables.server.php

and also check https://stackoverflow.com/a/3003233/1868660

Community
  • 1
  • 1
Subodh Ghulaxe
  • 18,333
  • 14
  • 83
  • 102