Get referring site IP address in PHP -
I want to implement a referral program for my SaaS product.
The partner's link will be on their website which will send their user to my signup form:
domain.com/referral/201030
Being a member id from the partner "201030"
I have to make sure that the page request came from my partner site,
I know that I have a $ _ server ['HTTP_REFERER']
but which is not secure.
Is there a way that I can see the IP address of the site in the context of my webpage with PHP?
When do you need high security?
For example, And can make sure that only the Certified Clients can access the API.
When?
A referral program can be used like this Security is not required.
You have more traffic, better for you. You do not care where it is from Coming when I send my partner program link from someone via Messenger, even there is not even an HTTP_REFERER.
Is it possible?
It
It is very difficult Using the stable link, this is the $ _ server ['HTTP_REFERER']
. You can answer below now, but it does not change the fact that with a simple, non-dynamic link Is shown in the question.
Referrer an IP
to convert HTTP_REFERER to IP:
$ urlParts = parse_url ( $ _ SERVER ['HTTP_REFERER']); $ Ip = gethostbyname ($ urlParts ['Host']);
Keep in mind, it is not reliable or safe in any way.
Comments
Post a Comment