[Recommended] CURL forgery of IP addresses and sources-PHP Tutorial-php Tutorial

Source: Internet
Author: User
[Recommended] CURL spoofs IP addresses and sources. A good IP address change solution was provided to the ticket-Flushing friends. after checking the solution, CURL is really powerful and can forge IP addresses and sources. 1. php request 2.php. 1. php code: $ chcurl_init (); curl_seto provides a good IP address change solution for the "ticket swiping" friends. after checking the code, 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-FOR: 8.8.8.8 ', 'client-IP: 8.8.8.8'); // Construct an IP address
Curl_setopt ($ ch, CURLOPT_REFERER, "http://www.gosoa.com.cn/"); // Construct a path
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
$ Out = curl_exec ($ ch );
Curl_close ($ ch );

2. the php code is as follows:

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"];

Forged successfully. Is that true !!

Bytes. 1. php requests 2.php. 1. php code: $ ch = curl_init (); curl_seto...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.