Php uses Curl to forge the client source IP address

Source: Internet
Author: User
I found many methods on the internet to use Curl to forge the client source IP address, almost all of which use the curl function. later I verified that this function is powerful, not only can the client source IP address be forged, but also the proxy IP address be forged. let's look at the code. General server acquisition... I found many methods on the internet to use Curl to forge the client source IP address, almost all of which use the curl function. later I verified that this function is powerful, not only can the client source IP address be forged, but also the proxy IP address be forged. let's look at the code.

Generally, the server can obtain the client IP address in three cases.

1. if no proxy is used:

# Http://www.phprm.com

REMOTE_ADDR = customer IP

HTTP_VIA = null

HTTP_X_FORWARDED_FOR = null

2. when the proxy is used and the proxy server has the IP address of the forwarding client configured:

REMOTE_ADDR = proxy server IP address

HTTP_VIA = proxy server IP address

HTTP_X_FORWARDED_FOR = customer IP

The HTTP_VIA and HTTP_X_FORWARDED_FOR values can be customized by adding the Header to hide the client IP, provided that X_FORWARDED_FOR is enabled on the server.

Test results: Create a PHP program on the server.

Example code 1: The code is as follows:

 

Example code 2: php code:

 

Forged successfully. does this provide a good IP address change solution for "fake tickets"? haha.

Result:

HTTP/1.1 200 OK Date: Wed, 03 Apr 2013 06:20:42 GMT Server: Apache/2.2.22 (Win32) PHP/5.3.13 X-Powered-By: PHP/5.3.13 Content-Length: 44 Content-Type: text/html IP: 8.8.8.8 referer: http://www.phprm.com/

The following describes the curl function.

List of curl-related functions:

Curl_init-initialize a CURL session curl_setopt-set an option for CURL call curl_exec-execute a CURL session curl_close-close a CURL session curl_version-return the current CURL version 1> curl_init-initialize a CURL session

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.