PhpCURL spoofs IP addresses and source implementation programs. It is very easy for php to forge IP sources. we only need to use phpcurl to forge IP sources. you can write IP addresses at will. Copy the following instance code to forge an IP address source. for php, you only need to use php curl to forge an IP address source. you can write an IP address at will.
Instance
The code is as follows: |
|
$ 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'); // IP Curl_setopt ($ ch, CURLOPT_REFERER, "http://www.hzhuti.com /"); // Curl_setopt ($ ch, CURLOPT_HEADER, 1 ); $ Out = curl_exec ($ ch ); Curl_close ($ ch ); |
2. php code:
The 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"]; Request 2.php with 1.php and output the result: IP: 8.8.8.8 referer: http://www.hzhuti.com |
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 items.
CURL Library Function in PHP)
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 function curl_init () 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.
Curl can be used to forge IP sources. you can write IP addresses at will. The instance code is as follows...