How does PHP implement CURL forgery of IP addresses and sources?

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.