The example in this article describes how PHP uses CURL to forge IP and source. Share it with everyone for your reference. The specific analysis is as follows:
Fake IP source is a very simple thing for PHP. We only need to use PHP's curl to realize the function of forging IP source. You can write the IP address as you like.
index.php example code is as follows:
IP:8.8.8.8 referer:http://www.jb51.net
The forgery is successful. Does this provide a good solution for collecting friends to change IP? Of course, friends who want to prevent being swiped should also pay attention.
Supplement:
The CURL function library (Client URL Library Function) in PHP is as follows:
curl_close — close a curl session
curl_copy_handle — Copy all contents and parameters of a curl connection resource
curl_errno — Returns a numeric number containing error information for the current session
curl_error — Returns a string containing error information for the current session
curl_exec — execute a curl session
curl_getinfo — Get information about a curl connection resource handle
curl_init — initialize a curl session
curl_multi_add_handle — Add individual curl handle resources to a curl batch session
curl_multi_close — close a batch handle resource
curl_multi_exec — parse a curl batch handle
curl_multi_getcontent — Returns the text stream of the obtained output
curl_multi_info_read — Get the relevant transmission information of the currently parsed curl
curl_multi_init — Initialize a curl batch handle resource
curl_multi_remove_handle — remove a handle resource in the curl batch handle resource
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 — Get curl-related version information
The curl_init() function is used to initialize a curl session. The only parameter of the curl_init() function is optional and represents a URL address.
The function of the curl_exec() function is to execute a curl session, and the only parameter is the handle returned by the curl_init() function.
The curl_close() function is used to close a curl session. The only parameter is the handle returned by the curl_init() function.
I hope this article will be helpful to everyone’s PHP programming design.