1

I think I'm not understanding this well...

I'm developing a php script, which inserts a new row in my table. But there's one field named 'ip_address', and I want to use a proxy which I have, to change ip address, to not insert always the same ip (the server of my website).

I'm doing this:

$loginpassw = 'login:passw'; $proxy_ip = 'xx.xxx.xxx.xxx'; $proxy_port = 'xx'; $url = "http://www.domain.com"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port); curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP'); curl_setopt($ch, CURLOPT_PROXY, $proxy_ip); curl_setopt($ch, CURLOPT_PROXYUSERPWD, $loginpassw); $data = curl_exec($ch); curl_close($ch); 

How to obtain the changed ip? I want obtain it, and insert it in database.

Best regards, Daniel

EDIT: What I really want is not being detected I'm doing through the same ip...

1
  • what ur talking about is IP Spoofing. This is illegal except for some cases Commented Apr 30, 2015 at 15:23

2 Answers 2

1

The script receiving the GET query should be able to obtain clients IP address by accessing this variable: $_SERVER['REMOTE_ADDR']. This should return the address of the proxy server.

Sign up to request clarification or add additional context in comments.

Comments

1

Try this

function Get_Real_IpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } if (!$ip) $ip = ''; return $ip; } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.