Change IP in PHP

Sniper

Regular Member
Joined
Dec 30, 2008
Messages
472
Reaction score
218
Anyone know how to or if it is possible to change the IP address of a visitor.

For example, if I use REMOTE_ADDR to get the IP, it will show my IP. Is there a way I can change this to whatever I want?

To further expand on this question.. is there a way to either spoof or blank the "X-PHP-Script" when using the php mail command?
 
Last edited:
No one hey? I was searching and it doesn't look really possible.. unless someone can help...
 
If you mean, you want to change IP of your PC using PHP and if you have dynamic IP connection then you can do by executing "rasdial" command using php.
 
I'm not quite sure what the point would be in changing the visitor's IP. Like any variable, you can access $_SERVER['REMOTE_ADDR'] perfectly fine but changing it won't actually effect your visitor's IP address.

As for mail, try http://sourceforge.net/projects/phpmailer/ or some other mail script. These can allow the usage of SMTP, proxies, etc.
 
I think you should read up a bit more about TCP/IP and PHP in general.
Your question does not make sense in more than one way:
a) you can not change the ip address of a visitor.
b) of course you can change the remote address variable, it makes no sense but it's a normal variable that is generated from the http headers.
c) For mailing you might want to take a look at the PEAR:Mail project. the php internal mail() isn't good for anything serious.
With PEAR:Mail you can influence more.
 
Justone, actually, that leads me in the correct direction. If you do a mail() in Php, and look at the source of the mail, you will see the x-php-script, and that identifies the IP of the calling web browser. If I can fake this IP, then essentially, I can send anonymous emails.

I am calling the php via a desktop mailing software that passes teh contents of the mail to be sent via url, and the mail php just blasts it out.

The only thing showing would be the url to the php file and if you cover tracks on some hosting you don't care about, then you might be able to use it.

So how would I change the http header to show a fake IP?

Surely it isn't as simply as $_SERVER['REMOTE_ADDR'] = "1.2.3.4"
 
use PEAR:MAIL, you can define any headers in there.
But don't forget two things:
a) the sendmail daemon adds your IP too, you can not fake that without hacking it
b) the receiver will always see which server sent the mail
 
you could use proxy in php, to change the ip address
 
Would something like this be accomplished with blind ip spoofing?
 
Part of the negotiation (between remote server and client) in TCP/IP is the IP address - so you cannot forge the IP of a TCP/IP request.

You can use a proxy, but that isnt spoofing. Its just using a 3rd party to forward requests.

You can only spoof with UDP.
 
Back
Top