Php uses CURL to forge IP addresses and source instances _ PHP Tutorial

Source: Internet
Author: User
Php uses CURL to forge IP addresses and source instances. Php uses CURL to forge IP addresses and source instances. This article describes how php uses CURL to forge IP addresses and sources, the principles and implementation of CURL spoofing IP addresses and sources are analyzed in detail in the form of instances. php uses CURL to forge IP addresses and source instances.

This article mainly introduces how php uses CURL to forge IP addresses and sources, and analyzes in detail the principles and implementation skills of CURL to forge IP addresses and sources in the form of instances, and added the common functions of the CURL function library in PHP. For more information, see

This article describes how php uses CURL to forge IP addresses and sources. Share it with you for your reference. The specific analysis is as follows:

It is very easy for php to forge IP sources. we only need to use php curl to forge IP sources. you can write IP addresses at will.

The index. php instance code is as follows:

The code is as follows:

$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/curl. php ");
Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('x-FORWARDED-FOR: 8.8.8.8 ', 'client-IP: 8.8.8.8'); // IP
Curl_setopt ($ ch, CURLOPT_REFERER, "http://www.jb51.net /"); //
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
$ Out = curl_exec ($ ch );
Curl_close ($ ch );


The curl. php code is as follows:

The code is as follows:

Function getClientIp (){
If (! Emptyempty ($ _ SERVER ["HTTP_CLIENT_IP"])
$ Ip = $ _ SERVER ["HTTP_CLIENT_IP"];
Else if (! Emptyempty ($ _ SERVER ["HTTP_X_FORWARDED_FOR"])
$ Ip = $ _ SERVER ["HTTP_X_FORWARDED_FOR"];
Else if (! Emptyempty ($ _ SERVER ["REMOTE_ADDR"])
$ Ip = $ _ SERVER ["REMOTE_ADDR"];
Else
$ Ip = "err ";
Return $ ip;
}
Echo "IP:". getClientIp ()."";
Echo "referer:". $ _ SERVER ["HTTP_REFERER"];


Use index. php to request curl. php. the output result is as follows:

IP: 8.8.8.8 referer: http://www.jb51.net

Forged successfully. does this provide a good IP address change solution for the collected friends? of course, you should pay attention to the anti-fake friends.

Supplement:

The CURL Library Function in PHP is as follows:

Curl_close-close a curl session

Curl_copy_handle-copy all content and parameters of a curl connection resource

Curl_errno-a number containing the current session error message is returned.

Curl_error-returns a string containing the current session error message.

Curl_exec-execute a curl session

Curl_getinfo-obtains the information of a curl connection resource handle.

Curl_init-initialize a curl session

Curl_multi_add_handle-add a separate curl handle resource to the curl batch processing session

Curl_multi_close-close a batch processing handle resource

Curl_multi_exec-parse a curl batch handle

Curl_multi_getcontent-return the obtained output text stream

Curl_multi_info_read-obtains the transmission information of the currently resolved curl.

Curl_multi_init-initialize a curl batch processing handle resource

Curl_multi_remove_handle-remove a handle resource from the curl batch processing handle.

Curl_multi_select-Get all the sockets associated with the cURL extension, which can then be "selected"

Curl_setopt_array-set session parameters for a curl in the form of an array

Curl_setopt-set session parameters for a curl

Curl_version-obtain curl-related version information

The role of the curl_init () function initializes a curl session. the unique parameter of the curl_init () function is optional, indicating a url address.

The role of the curl_exec () function is to execute a curl session. the unique parameter is the handle returned by the curl_init () function.

The function curl_close () is used to close a curl session. the only parameter is the handle returned by the curl_init () function.

I hope this article will help you with php programming.

Ghost This article mainly introduces how php uses CURL to forge IP addresses and sources, and analyzes in detail the principles and implementation techniques of CURL spoofing IP addresses and sources in the form of instances...

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.