PHP uses curl to forge an IP address. PHP uses curl to forge an IP address. phpcurl is an introduction to ipcurl forgery: curl is a file transfer tool that uses the URL syntax in the command line mode. It supports many protocols: FTP, a simple method for using curl to forge IP addresses in PHP, and phpcurl to forge ip addresses
Curl introduction:
Curl is a file transfer tool that uses the URL syntax to work in the command line mode. It supports many protocols: FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE, and LDAP. Curl also supports HTTPS authentication, http post, http put, FTP upload, HTTP upload, proxy server, cookies, user name/password authentication, resumable download of downloaded files, and so on, powerful functions.
Common functions implemented by curl in PHP:
1. remote acquisition and collection of content
2. implement FTP upload and download for PHP web edition
3. implement simulated login
4. interface interconnection (API) and data transmission
5. implement Cookie simulation.
PHP uses the CURL function
By default, PHP does not support the CURL function. you must enable this function in PHP. ini.
; Extension = php_curl.dll // first remove the front; semicolon, and restart Apache/IIS
Use curl to forge an IP address
Copy the IP address I found to the txt file, and sed and awk processed it. I will share my awk processing script:
#! /Bin/awk-f # BEGIN {FS = ""; count = 0 ;}# running {iparr [count ++] = $0 ;} # END {printf ("<? Php \ n "); printf (" $ iparr = array (\ n "); for (I = 0; I <count; I ++) {printf ("'% s' =>' % s', \ n", iparr [I], iparr [I]);} printf ("); \ n ");}
CURL usage
<?php require_once dirname(__FILE__) . "/iplib.php"; $req_url = "test.com"; foreach ($iparr as $forward => $cip) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $req_url); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "X-FORWARDED-FOR:$forward", "CLIENT-IP:$cip" )); curl_setopt($ch, CURLOPT_REFERER, 'http://blog.csdn.net/'); curl_setopt($ch, CURLOPT_HEADER, 1); curl_exec($ch); curl_close($ch); }
Defects
Many servers generally use $ _ SERVER ['remote _ ADDR '] to obtain the client's real ip address, which is determined at the transport layer and cannot be modified through CURL, well, it seems that I have not helped my friends do this thing successfully, but record it.
Curl introduction: curl is a file transfer tool that uses the URL syntax to work in the command line mode. It supports many protocols: FTP ,...