Tutorial on using CURL to forge source URL and IP_PHP

Source: Internet
Author: User
Use CURL to forge the source URL and IP address. Many votes have to verify the origin site and IP address, but CURL can be forged into any URL and IP address to bypass some simple verification. The following is a simple example. Many votes in the program are verified on the origin site and IP address, but the use of CURL can be forged into any URL and IP address, to bypass some simple verification, the following is a simple example.

Before running the program, make sure that extension = php_curl.dll is not commented out in php. ini.

Test. php

 

Test. php sends a request to test_2.php.

 IP: " . getClientIp() . "";  echo "
referer: " . $_SERVER["HTTP_REFERER"]; ?>

The program running result is as follows:

HTTP/1.1 200 OK Date: Tue, 01 Nov 2011 12:20:06 GMT Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9 X-Powered-By: PHP/5.2.9 Content-Length: 53 Content-Type: text/html IP: 8.8.8.8referer: http://www.bkjia.com/

As you can see, the IP address and address can be changed at will. you can use this for many vote functions that do not have a complete voting mechanism.

By the way, it's about the real IP address.

Generally, the environment variable $ _ SERVER ['remote _ ADDR '] is used to obtain the user IP address. However, this variable only records the last host IP address. Therefore, when the user's browser sets a Proxy, the real IP address cannot be obtained.

In this case, you can use another environment variable $ _ SERVER ['http _ X_FORWARDED_FOR '] to record the host IP address, which is generated only when the user passes through the Proxy, therefore, you can write as follows to obtain the real IP address of the user.

   

Bytes. Program...

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.