Home > Article > Backend Development > php CURL fake IP and source implementation program_PHP tutorial
Forging the IP source is a very simple thing for PHP. We only need to use php curl to achieve the forged IP source. You can write the IP address as you like.
Example
The code is as follows
|
Copy code
|
||||||||
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'));//IPcurl_setopt($ch, CURLOPT_REFERER, "http://www.hzhuti.com / "); // Origin curl_setopt($ch, CURLOPT_HEADER, 1);$out = curl_exec($ch);
IP: 8.8.8.8 referer:http://www.hzhuti.com curl_init — initialize a curl session curl_multi_add_handle — add a separate curl handle resource to the curl batch session curl_multi_close — close a batch handle resource curl_multi_exec — parsing A curl batch handle curl_multi_getcontent — Returns the text stream of the obtained output curl_multi_info_read — Gets the relevant transmission information of the currently parsed curl curl_multi_init — Initializes a curl batch handle resource curl_multi_remove_handle — Remove A handle resource in the curl batch handle resourcecurl_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 arraycurl_setopt — Set session parameters for a curl curl_version — Get curl-related version information The role of the curl_init() function is to initialize a curl session. The only parameter of the curl_init() function is optional. Represents a url address. The curl_exec() function is used to execute a curl session. 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.
http://www.bkjia.com/PHPjc/444658.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444658.htmlTechArticleFake IP source is a very simple thing for php, we only need to use php curl to achieve it Forge the source of the IP. You can write the IP address as you like. Example code is as follows Copy the code...
|