Radhakrishna Chowdary Radhakrishna Chowdary - 1 year ago 114
JSON Question

Getting IP address of a client who sent a cURL request with JSON raw POST data

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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download