2014-11-25 104 views
0

我在Firefox中使用代理服务器扩展来更改我的IP地址。代理服务器在php

有没有在PHP脚本来改变IP地址?我发现只有域名更改脚本在PHP中,但不是IP相关的脚本。任何建议请。

+0

请检查此链接:http://stackoverflow.com/questions/8271921/change-ip-address-of-server -using-php – 2014-11-25 06:14:58

回答

0

使用curl,你可以做到这一点...尝试以下之一:

<?php 

     $proxy = "xx.xx.xx.xx:xx"; 
     $proxy = explode(':', $proxy); 
     $url = "http://www.google.com"; 

     $ch = curl_init(); 
     curl_setopt($ch, CURLOPT_URL, $url); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
     curl_setopt($ch, CURLOPT_PROXY, $proxy[0]); 
     curl_setopt($ch, CURLOPT_PROXYPORT, $proxy[1]); 
     curl_setopt($ch, CURLOPT_HEADER, 1); 
     $exec = curl_exec($ch); 

    ?> 
+0

感谢您的回复。我不明白如何使用它。你能解释一下吗?在'$ proxy'中,我把我的代理IP地址,然后我运行脚本。要检查IP地址,我把'$ _SERVER ['SERVER_ADDR']'它显示我的IP而不是代理。 – Gowri 2014-11-25 06:32:05