Counterfeit IP source is useful to many friends. some friends like to use phpcurl to forge IP source, which makes them feel a lot of IP addresses, the following describes the curl usage in php by using a counterfeit IP source instance. curl is disabled by default... counterfeit IP source is useful to many friends. some friends like to use php curl to forge IP source, which makes them feel a lot of IP addresses, the following describes the curl usage in php by using a counterfeit IP source instance.
Curl is disabled by default.
Enable cURL settings:If you are on Windows, it is very simple. you need to modify the settings of your php. ini file, find php_curl.dll, and cancel the semicolon comment, as shown below:
Extension = php_curl.dll
If you are in Linux, you need to recompile your PHP. during editing, you need to open the compilation parameter -- add the "-with-curl" parameter to the configure command.
The code for a simple test is as follows:
The following code imitates post data:
Now let's go to the question: CURL spoofs the IP address and source.
1. the php instance code is as follows:
2. the php instance code is as follows:
Use 1.php to request 2.php and output the result.
For SSL, that is, the HTTPS protocol, you only need to change the http: // in the CURLOPT_URL connection to https: //. of course, there is also a parameter named CURLOPT_SSL_VERIFYHOST that can be set to the verification site.
For Cookie, you need to understand the following three parameters:
CURLOPT_COOKIE: set a cookie in the face-to-face session.
CURLOPT_COOKIEJAR saves a Cookie when the session ends.
CURLOPT_COOKIEFILE: Cookie file