Curl Introduction:
Curl is a file transfer tool that uses URL syntax to work in a command-line manner. It supports many protocols: FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE, and LDAP. Curl also supports HTTPS authentication, HTTP POST method, HTTP put method, FTP upload, HTTP upload, proxy server, cookies, username/password Authentication, download file breakpoint, etc., the function is very powerful.
PHP Common Curl Implementation features:
1, the realization of remote access and collection of content
2, the implementation of PHP Web version of FTP upload download
3, the realization of analog landing
4, the implementation of interface docking (API), data transmission, etc.
5, the implementation of analog cookies, etc.
PHP uses the Curl feature
PHP does not support curl functionality by default, and you need to turn this feature on in php.ini
; extension= php_curl.dll//First remove the preceding semicolon, and restart Apache/iis
Using Curl to forge IP
I found the IP copy into TXT file, and then sed and awk handled it and shared my awk processing script:
#!/bin/awk-f
#运行前
BEGIN {
FS = "";
Count = 0;
}
#运行中
{
Iparr[count + +] = $
}
#运行后 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 use
<?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 are generally used $_server[' remote_addr ' to get the real IP of the client, this is the address in the transport layer has been decided, can not be modified through the curl, well, it seems that I did not help a friend to do the success of this matter, but still record