I've contacted some website administrators for their API, in return, they have asked for source IP, in order to whitelist it, so that only requests from that IP will be considered as legit (it is ok even if it is a shared IP).
So, now the problem is how do i get the ip of the site. Being a PHP developer, I've tried gethostbyname() which gives random ip's & also $_SERVER['REMOTE_ADDR'] (called from other server) which always gives the single IP. I'm totally confused with this, also I've very less time to give them my source IP.
I don't have paid hosting. I always use, free tiers of appfog (*.aws.af.cm) & openshift (*-name.rhcloud.com). It would be great if someone can tell me the process for finding any of those IP addresses or show me a way to get a static IP (which i could share with them) for free or another host. Also, they have given permission to use this API only for 10days.
UPDATE: I've also tried ping mysite.aws.af.cm (which is same as gethostbyname()) gives different IPs for different calls.
Web hosts usually have static IP addresses but I'm surprised they require an IP for a web-based API instead of a domain/some kind of secret key.
Have you considered just pinging your domain, as the ping command will convert your domain into the IP address it correspondes to?
EDIT: Another solution.
Considering your API is being contacted by the server, I have created a file on my own website that returns $_SERVER['REMOTE_ADDR'], BUT you should access the file using a script on your site!
Upload the following to your website and run it: