A simple example of phpcurl spoofing ip address
-
- $ Ch = curl_init ();
- Curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/index. php ");
- $ R = revert (1,255 );
- Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('x-FORWARDED-FOR: 8.8.8. '. $ r, 'client-IP: 125.8.8. '. $ r); // Construct an IP address
- Curl_setopt ($ ch, CURLOPT_REFERER, "http://bbs.it-home.org"); // Construct a path
- Curl_setopt ($ ch, CURLOPT_HEADER, 0); // 0: no output; 1: output
- $ Out = curl_exec ($ ch );
- Curl_close ($ ch );
- ?>
-
2. php forged IP address information index. php
- 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
- $ Ip = "err ";
- Return $ ip;
- }
- Echo "IP:". getClientIp ()."";
- // Echo "referer:". $ _ SERVER ["HTTP_REFERER"];
- ?>
|