Home > Backend Development > PHP Tutorial > CULR代理IP的实现,坐等神人

CULR代理IP的实现,坐等神人

WBOY
Release: 2016-06-13 12:32:22
Original
1052 people have browsed it

CULR代理IP的实现,坐等神人!【急】
打印$_SERVER['REMOTE_ADDR'];获取到真实IP
$_SERVER['HTTP_X_FORWARDED_FOR'];获取到代理IP

 

实现用代理访问网址返回网页内容

$ip = rand(1,255).'.'.rand(1,255).'.'.rand(1,255).'.'.rand(1,255);
$headerArr[] = 'X-FORWARDED-FOR' .':' . $ip;  
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "http://ip138.com");
curl_setopt ($ch, CURLOPT_HTTPHEADER , $headerArr ); 
$re=curl_exec($ch);
var_dump($re);


这是我写的代码,没什么用。
$_SERVER['REMOTE_ADDR'];打印出我真实的IP
$_SERVER['HTTP_X_FORWARDED_FOR'];打印出来的是我虚拟的IP

能让程序返回内容中的IP显示为代理IP即可

PHP CURL IP代理
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template