Phpcurl is too powerful as an example of counterfeit IP source phpcurl. it not only imitates user logon, but also imitates user IP addresses to forge IP source. File fake_ip.php: & lt ;? Php $ chcurl_init (); $ urllocalhosttarget_ip.php; $ headerarray (php curl counterfeit IP source example)
Php curl is too powerful. it not only imitates user logon, but also imitates user IP addresses, to forge IP sources.
Curl sends the request file fake_ip.php:
Target file target_ip.php of the request:
The IP address printing sequence in the target file target_ip is the IP address acquisition sequence of many open-source systems.
Access fake_ip.php and see the result:
58.68.44.61
58.68.44.61
127.0.0.1
Instance
CURL is really powerful and can forge IP addresses and sources.
1. php requests 2.php.
1. php code:
$ Ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/2.php"); curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('x-FORWARDED-: 8.8.8.8 ', 'client-IP: 8.8.8.8'); // Construct an IP address www. jbxue. comcurl_setopt ($ ch, CURLOPT_REFERER, "http://www.jb51.net/"); // Construct the Origin curl_setopt ($ ch, CURLOPT_HEADER, 1); $ out = curl_exec ($ ch ); curl_close ($ ch );
2. php code:
function getClientIp() { if (!empty($_SERVER["HTTP_CLIENT_IP"])) $ip = $_SERVER["HTTP_CLIENT_IP"]; else if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; else if (!empty($_SERVER["REMOTE_ADDR"])) $ip = $_SERVER["REMOTE_ADDR"]; else // www.jbxue.com$ip = "err"; return $ip; } echo "IP: " . getClientIp() . ""; echo "referer: " . $_SERVER["HTTP_REFERER"];
Forged successfully. does this provide a good IP address change solution for the "ticket swiping" friend?