Hướng dẫn php curl mimic browser - trình duyệt bắt chước php curl

Tôi đang gặp một số vấn đề với yêu cầu trình duyệt mà tôi đang cố gắng sao chép với Curl. Tôi hiện đang làm việc trong một dự án đại học và bị mắc kẹt.

Tôi đang cố gắng sao chép yêu cầu trình duyệt theo URL sau: http://vm.tiktok.com/e9vdx8/ Khi tôi truy cập trang trong trình duyệt của mình, tôi được chuyển hướng đến một trang với video và một số nội dung khác. Khi tôi thử sử dụng Curl, tôi đang được hiển thị một lỗi không tìm thấy trang 404. Yêu cầu Curl của tôi trông giống như sau.

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_USERAGENT, $USER_AGENT);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt( $ch, CURLOPT_COOKIEJAR,  realpath('./cookies.txt') );
        curl_setopt( $ch, CURLOPT_COOKIEFILE, realpath('./cookies.txt') );
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_HEADER, TRUE);
        curl_setopt($ch, CURLOPT_URL, $url);
        $result = curl_exec($ch);

Tôi đã xem các tiêu đề từ URL ban đầu trong trình duyệt và cố gắng sao chép chúng vào Curl nhưng tôi vẫn nhận được trang 404. Nếu tôi sao chép yêu cầu trình duyệt dưới dạng yêu cầu Curl từ các công cụ của nhà phát triển Chrome và chạy nó trong thiết bị đầu cuối, nó hoạt động tốt.

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed

Bất kỳ trợ giúp sẽ được thực sự đánh giá cao. Tôi bị vấp ngã.

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
05

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
06

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
07

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
08

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
09

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
10

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
11

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
12

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
13

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
14

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
15

Sử dụng đơn giản

Nhận trang chính từ máy chủ web:

curl https://www.example.com/

Nhận tệp readme từ máy chủ FTP:

curl ftp://ftp.funet.fi/README

Nhận một trang web từ một máy chủ bằng cổng 8000:

curl http://www.weirdserver.com:8000/

Nhận danh sách thư mục của một trang web FTP:

curl ftp://ftp.funet.fi

Nhận định nghĩa của Curl từ một từ điển:

curl dict://dict.org/m:curl

Tìm nạp hai tài liệu cùng một lúc:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/

Nhận một tệp TẮT một máy chủ FTPS:

curl ftps://files.are.secure.com/secrets.txt

hoặc sử dụng cách FTPS phù hợp hơn để có cùng một tệp:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt

Nhận tệp từ máy chủ SSH bằng SFTP:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
0

Nhận tệp từ máy chủ SSH bằng SCP bằng khóa riêng (không được bảo vệ bằng mật khẩu) để xác thực:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
1

Nhận tệp từ máy chủ SSH bằng SCP bằng khóa riêng (được bảo vệ bằng mật khẩu) để xác thực:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
2

Nhận trang chính từ máy chủ web IPv6:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
3

Nhận tệp từ máy chủ SMB:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
4

Tải xuống tệp

Nhận một trang web và lưu trữ trong một tệp cục bộ có tên cụ thể:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
5

Nhận một trang web và lưu trữ trong một tệp cục bộ, làm cho tệp cục bộ lấy tên của tài liệu từ xa (nếu không có phần tên tệp được chỉ định trong URL, điều này sẽ không thành công):

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
6

Tìm nạp hai tệp và lưu trữ chúng với tên từ xa của chúng:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
7

Sử dụng mật khẩu

FTP

Đối với các tệp FTP bằng tên và mật khẩu, hãy đưa chúng vào URL như:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
8

hoặc chỉ định chúng bằng cờ

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
16 như

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
9

Ftps

Nó giống như đối với FTP, nhưng bạn cũng có thể muốn chỉ định và sử dụng các tùy chọn dành riêng cho SSL cho chứng chỉ, v.v.

Lưu ý rằng sử dụng

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
17 làm tiền tố là cách ngầm như được mô tả trong các tiêu chuẩn trong khi cách rõ ràng được đề xuất được thực hiện bằng cách sử dụng tùy chọn
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
18 và
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
19.

SFTP / SCP

Điều này tương tự như FTP, nhưng bạn có thể sử dụng tùy chọn

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
20 để chỉ định khóa riêng để sử dụng thay vì mật khẩu. Lưu ý rằng khóa riêng có thể được bảo vệ bởi mật khẩu không liên quan đến mật khẩu đăng nhập của hệ thống từ xa; Mật khẩu này được chỉ định bằng tùy chọn
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
21. Thông thường, Curl sẽ tự động trích xuất khóa công khai từ tệp khóa riêng, nhưng trong trường hợp Curl không có hỗ trợ thư viện phù hợp, phải chỉ định tệp khóa công khai phù hợp bằng tùy chọn
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
22.

HTTP

Curl cũng hỗ trợ người dùng và mật khẩu trong URL HTTP, do đó bạn có thể chọn một tệp như:

curl https://www.example.com/
0

hoặc chỉ định riêng người dùng và mật khẩu như trong

curl https://www.example.com/
1

HTTP cung cấp nhiều phương pháp xác thực và Curl khác nhau hỗ trợ một số: cơ bản, tiêu hóa, NTLM và đàm phán (Spnego). Không cần sử dụng phương pháp nào, Curl mặc định là cơ bản. Bạn cũng có thể yêu cầu Curl chọn những cái an toàn nhất trong số những cái mà máy chủ chấp nhận cho URL đã cho, bằng cách sử dụng

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
23.

Ghi chú! Theo thông số kỹ thuật URL, URL HTTP không thể chứa người dùng và mật khẩu, do đó kiểu đó sẽ không hoạt động khi sử dụng Curl thông qua proxy, mặc dù Curl cho phép nó vào những thời điểm khác. Khi sử dụng proxy, bạn phải sử dụng kiểu

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
16 cho người dùng và mật khẩu.! According to the URL specification, HTTP URLs can not contain a user and password, so that style will not work when using curl via a proxy, even though curl allows it at other times. When using a proxy, you must use the
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
16 style for user and password.

HTTPS

Có lẽ thường được sử dụng với chứng chỉ riêng, như được giải thích dưới đây.

Ủy quyền

Curl hỗ trợ cả máy chủ proxy HTTP và SOCKS, với xác thực tùy chọn. Nó không có sự hỗ trợ đặc biệt cho các máy chủ proxy FTP vì không có tiêu chuẩn nào cho chúng, nhưng nó vẫn có thể được thực hiện để làm việc với nhiều người trong số chúng. Bạn cũng có thể sử dụng cả proxy HTTP và SOCKS để chuyển các tệp đến và từ các máy chủ FTP.

Nhận tệp FTP bằng proxy HTTP có tên My-Proxy sử dụng cổng 888:

curl https://www.example.com/
2

Nhận tệp từ máy chủ HTTP yêu cầu người dùng và mật khẩu, sử dụng cùng một proxy như trên:

curl https://www.example.com/
3

Một số proxy yêu cầu xác thực đặc biệt. Chỉ định bằng cách sử dụng -u như trên:

curl https://www.example.com/
4

Một danh sách các máy chủ và tên miền được phân tách bằng dấu phẩy có thể được chỉ định là:

curl https://www.example.com/
5

Nếu proxy được chỉ định với

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
25 thay vì
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
26 hoặc
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
27, thì Curl sẽ sử dụng HTTP/1.0 thay vì HTTP/1.1 cho bất kỳ nỗ lực
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
28 nào.

Curl cũng hỗ trợ các proxy SOCKS4 và SOCKS5 với

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
29 và
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
30.

Xem thêm các biến môi trường Curl hỗ trợ cung cấp thêm kiểm soát proxy.

Hầu hết các máy chủ proxy FTP được thiết lập để xuất hiện dưới dạng máy chủ FTP bình thường theo quan điểm của máy khách, với các lệnh đặc biệt để chọn máy chủ FTP từ xa. Curl hỗ trợ các tùy chọn

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
16,
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
32 và
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
33 có thể được sử dụng để thiết lập chuyển khoản thông qua nhiều proxy FTP. Ví dụ: một tệp có thể được tải lên máy chủ FTP từ xa bằng cách sử dụng proxy FTP màu xanh lam với các tùy chọn:

curl https://www.example.com/
6

Xem hướng dẫn cho proxy FTP của bạn để xác định biểu mẫu mà nó dự kiến ​​sẽ thiết lập chuyển khoản và tùy chọn

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
34 của Curl để xem chính xác những gì Curl đang gửi.

Các dãy

HTTP 1.1 được giới thiệu phạm vi byte. Sử dụng điều này, một khách hàng có thể yêu cầu chỉ nhận được một hoặc nhiều phần phụ của một tài liệu được chỉ định. Curl hỗ trợ điều này với cờ

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
35.

Nhận 100 byte đầu tiên của một tài liệu:

curl https://www.example.com/
7

Nhận 500 byte cuối cùng của một tài liệu:

curl https://www.example.com/
8

Curl cũng hỗ trợ các phạm vi đơn giản cho các tệp FTP. Sau đó, bạn chỉ có thể chỉ định vị trí bắt đầu và dừng.

Nhận 100 byte đầu tiên của tài liệu bằng FTP:

curl https://www.example.com/
9

Tải lên

FTP / FTPS / SFTP / SCP

Tải tất cả dữ liệu trên Stdin lên một máy chủ được chỉ định:

curl ftp://ftp.funet.fi/README
0

Tải dữ liệu từ một tệp được chỉ định, đăng nhập bằng người dùng và mật khẩu:

curl ftp://ftp.funet.fi/README
1

Tải tệp cục bộ lên trang web từ xa và sử dụng tên tệp cục bộ tại trang web từ xa:

curl ftp://ftp.funet.fi/README
2

Tải lên một tệp cục bộ để được thêm vào tệp từ xa:

curl ftp://ftp.funet.fi/README
3

Curl cũng hỗ trợ tải lên FTP thông qua proxy, nhưng chỉ khi proxy được cấu hình để cho phép loại đường hầm đó. Nếu có, bạn có thể chạy Curl trong một thời trang tương tự như:

curl ftp://ftp.funet.fi/README
4

SMB / SMB

curl ftp://ftp.funet.fi/README
5

HTTP

Tải tất cả dữ liệu trên STDIN lên một trang web HTTP được chỉ định:

curl ftp://ftp.funet.fi/README
6

Lưu ý rằng máy chủ HTTP phải được cấu hình để chấp nhận đặt trước khi điều này có thể được thực hiện thành công.

Để biết các cách khác để tải lên dữ liệu HTTP, hãy xem phần bài viết bên dưới.

Verbose / Debug

Nếu Curl thất bại ở nơi không được phép, nếu các máy chủ không cho phép bạn vào, nếu bạn không thể hiểu các câu trả lời: Sử dụng cờ

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
34 để lấy dòng chảy. Curl sẽ xuất nhiều thông tin và những gì nó gửi và nhận để cho người dùng thấy tất cả các tương tác máy khách-máy chủ (nhưng nó sẽ không hiển thị cho bạn dữ liệu thực tế).

curl ftp://ftp.funet.fi/README
7

Để có thêm chi tiết và thông tin về những gì Curl làm, hãy thử sử dụng các tùy chọn

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
37 hoặc
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
38 với tên tệp đã cho để đăng nhập, như thế này:

curl ftp://ftp.funet.fi/README
8

Thông tin chi tiết

Các giao thức khác nhau cung cấp các cách khác nhau để nhận thông tin chi tiết về các tệp/tài liệu cụ thể. Để có được Curl để hiển thị thông tin chi tiết về một tệp duy nhất, bạn nên sử dụng tùy chọn ____ 139/________ 140. Nó hiển thị tất cả thông tin có sẵn trên một tệp duy nhất cho HTTP và FTP. Thông tin HTTP rộng hơn rất nhiều.

Đối với HTTP, bạn có thể nhận thông tin tiêu đề (giống như

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
39 sẽ hiển thị) được hiển thị trước dữ liệu bằng cách sử dụng ________ 142/________ 143. Curl hiểu tùy chọn ____ 144/________ 145 khi nhận các tệp từ cả FTP và HTTP, và sau đó nó sẽ lưu trữ các tiêu đề trong tệp được chỉ định.

Lưu trữ các tiêu đề HTTP trong một tệp riêng biệt (tiêu đề.txt trong ví dụ):

curl ftp://ftp.funet.fi/README
9

Lưu ý rằng các tiêu đề được lưu trữ trong một tệp riêng biệt có thể hữu ích sau đó nếu bạn muốn Curl sử dụng cookie được gửi bởi máy chủ. Thông tin thêm về điều đó trong phần Cookies.

Đăng (HTTP)

Thật dễ dàng để đăng dữ liệu bằng Curl. Điều này được thực hiện bằng cách sử dụng tùy chọn

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
46. Dữ liệu bài phải được urlencoded.

Đăng một cuốn thư khách đơn giản

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
47 và
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
48.

curl http://www.weirdserver.com:8000/
0

Cách đăng một biểu mẫu với Curl, Bài học số 1:

Đào ra tất cả các thẻ

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
49 trong biểu mẫu bạn muốn điền vào.

Nếu có một bài viết bình thường, bạn sử dụng

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
50 để đăng.
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
50 có một chuỗi bài đầy đủ, ở định dạng

curl http://www.weirdserver.com:8000/
1

Tên biến là các tên được đặt với

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
52 trong các thẻ
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
49 và dữ liệu là nội dung bạn muốn điền vào các đầu vào. Dữ liệu phải được mã hóa URL đúng cách. Điều đó có nghĩa là bạn thay thế không gian bằng + và bạn thay thế các chữ cái kỳ lạ bằng
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
54 trong đó
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
55 là đại diện thập lục phân của mã ASCII của chữ cái.

Example:

(Trang nằm ở

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
56)

curl http://www.weirdserver.com:8000/
2

Chúng tôi muốn nhập người dùng

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
57 bằng mật khẩu
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
58.

Để đăng lên điều này, bạn nhập một dòng lệnh Curl như:

curl http://www.weirdserver.com:8000/
3

Mặc dù

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
50 sử dụng loại MIME của Ứng dụng/X-WWW-Form-urlencoded, thường được CGI của CGI hiểu và Curl cũng hỗ trợ loại dữ liệu đa dạng/đa dạng có khả năng hơn. Loại sau này hỗ trợ những thứ như tải lên tệp.

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
60 chấp nhận các tham số như
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
61. Nếu bạn muốn nội dung được đọc từ một tệp, hãy sử dụng
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
62 làm nội dung. Khi chỉ định một tệp, bạn cũng có thể chỉ định loại nội dung tệp bằng cách thêm
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
63 vào tên tệp. Bạn cũng có thể đăng nội dung của một số tệp trong một trường. Ví dụ: tên trường
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
64 được sử dụng để gửi ba tệp, với các loại nội dung khác nhau bằng cách sử dụng cú pháp sau:

curl http://www.weirdserver.com:8000/
4

Nếu loại nội dung không được chỉ định, Curl sẽ cố gắng đoán từ phần mở rộng tệp (nó chỉ biết một vài) hoặc sử dụng loại được chỉ định trước đó (từ một tệp trước đó nếu một số tệp được chỉ định trong danh sách) hoặc nếu không thì nó sẽ Sử dụng loại mặc định

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
65.

Mô phỏng một hình thức điền vào với

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
60. Giả sử bạn điền vào ba trường dưới dạng. Một trường là tên tệp để đăng, một trường là tên của bạn và một trường là mô tả tệp. Chúng tôi muốn đăng tệp chúng tôi đã viết có tên
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
67. Để Curl thực hiện việc đăng dữ liệu này thay vì trình duyệt yêu thích của bạn, bạn phải đọc nguồn HTML của trang biểu mẫu và tìm tên của các trường đầu vào. Trong ví dụ của chúng tôi, tên trường đầu vào là
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
68,
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
69 và
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
70.

curl http://www.weirdserver.com:8000/
5

Để gửi hai tệp trong một bài đăng, bạn có thể thực hiện theo hai cách:

Gửi nhiều tệp trong một trường duy nhất với một tên trường duy nhất:

curl http://www.weirdserver.com:8000/
6

Gửi hai trường có hai tên trường

curl http://www.weirdserver.com:8000/
7

Để gửi một giá trị trường theo nghĩa đen mà không diễn giải hàng đầu

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
71 hoặc
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
72 hoặc một
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
73 được nhúng, sử dụng
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
74 thay vì
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
60. Điều này được khuyến nghị khi giá trị được lấy từ người dùng hoặc một số nguồn không thể đoán trước khác. Trong những trường hợp này, sử dụng
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
60 thay vì
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
74 có thể cho phép người dùng lừa Curl tải lên một tệp.

Người giới thiệu

Yêu cầu HTTP có tùy chọn bao gồm thông tin về địa chỉ nào được chuyển đến trang thực tế. Curl cho phép bạn chỉ định người giới thiệu được sử dụng trên dòng lệnh. Nó đặc biệt hữu ích để đánh lừa hoặc lừa các máy chủ ngu ngốc hoặc các tập lệnh CGI dựa vào thông tin đó có sẵn hoặc chứa một số dữ liệu nhất định.

curl http://www.weirdserver.com:8000/
8

Đại lý người dùng

Yêu cầu HTTP có tùy chọn bao gồm thông tin về trình duyệt tạo ra yêu cầu. Curl cho phép nó được chỉ định trên dòng lệnh. Nó đặc biệt hữu ích để đánh lừa hoặc lừa các máy chủ ngu ngốc hoặc các tập lệnh CGI chỉ chấp nhận một số trình duyệt nhất định.

Example:

curl http://www.weirdserver.com:8000/
9

Các chuỗi phổ biến khác:

  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    78 - NetScape phiên bản 3 cho Windows 95
  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    79 - NetScape phiên bản 3 cho Windows 95
  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    80 - NetScape phiên bản 2 cho OS/2
  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    81 - Netscape cho AIX
  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    82 - Netscape cho Linux

Lưu ý rằng Internet Explorer cố gắng tương thích theo mọi cách:

  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    83 - MSIE cho W95

Mozilla không phải là tên tác nhân người dùng duy nhất có thể:

  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    84 - Máy tính để bàn quản lý tệp KDE
  • curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
    
    85 - Trình duyệt dòng lệnh Lynx

Bánh quy

Cookie thường được sử dụng bởi các máy chủ web để giữ thông tin nhà nước ở phía khách hàng. Máy chủ đặt cookie bằng cách gửi một dòng phản hồi trong các tiêu đề trông giống như

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
86 trong đó phần dữ liệu sau đó thường chứa một tập hợp các cặp
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
87 (được phân tách bằng dấu chấm phẩy
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
88 như
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
89). Máy chủ cũng có thể chỉ định cho đường dẫn cookie nào nên được sử dụng (bằng cách chỉ định
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
90), khi cookie sẽ hết hạn (
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
91), cho tên miền nào sẽ sử dụng (
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
92) và nếu nó chỉ được sử dụng trên các kết nối an toàn (
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
93 ).

Nếu bạn đã nhận được một trang từ một máy chủ có chứa tiêu đề như:

curl ftp://ftp.funet.fi
0

Điều đó có nghĩa là máy chủ muốn cặp đầu tiên được truyền lại khi chúng ta nhận được bất cứ thứ gì trong một đường dẫn bắt đầu bằng

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
94.

Ví dụ: Nhận một trang muốn tên tôi được truyền trong cookie:

curl ftp://ftp.funet.fi
1

Curl cũng có khả năng sử dụng cookie đã nhận trước đây trong các phiên sau. Nếu bạn nhận cookie từ máy chủ và lưu trữ chúng trong một tệp theo cách tương tự như:

curl ftp://ftp.funet.fi
2

... Sau đó, bạn có thể kết nối thứ hai với trang web đó (hoặc khác), sử dụng cookie từ tệp

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
95 như:

curl ftp://ftp.funet.fi
3

Mặc dù lưu các tiêu đề vào một tệp là một cách làm việc để lưu trữ cookie, tuy nhiên nó dễ bị lỗi và không phải là cách ưa thích để làm điều này. Thay vào đó, hãy tạo Curl lưu các cookie đến bằng định dạng cookie nổi tiếng của Netscape như thế này:

curl ftp://ftp.funet.fi
4

Lưu ý rằng bằng cách chỉ định

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
96, bạn sẽ bật động cơ cookie và với
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
97, bạn có thể tạo Curl theo
curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
98 (thường được sử dụng kết hợp với cookie). Nếu một trang web gửi cookie và trường vị trí, bạn có thể sử dụng một tệp không tồn tại để kích hoạt nhận thức cookie như:

curl ftp://ftp.funet.fi
5

Tệp để đọc cookie từ phải được định dạng bằng các tiêu đề HTTP đơn giản hoặc dưới dạng tệp cookie của Netscape. Curl sẽ xác định loại nào dựa trên nội dung tệp. Trong lệnh trên, Curl sẽ phân tích tiêu đề và lưu trữ các cookie nhận được từ www.example.com. Curl sẽ gửi đến máy chủ các cookie được lưu trữ phù hợp với yêu cầu khi nó tuân theo vị trí. Tệp

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
99 có thể là một tệp không tồn tại.

Để đọc và ghi cookie từ tệp cookie NetScape, bạn có thể đặt cả

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
96 và
curl https://www.example.com/
01 để sử dụng cùng một tệp:

curl ftp://ftp.funet.fi
6

Đồng hồ đo tiến độ

Đồng hồ đo tiến độ tồn tại để cho người dùng thấy rằng một cái gì đó thực sự đang xảy ra. Các trường khác nhau trong đầu ra có nghĩa sau:

curl ftp://ftp.funet.fi
7

Từ trái sang phải:

  • curl https://www.example.com/
    
    02 - Tỷ lệ phần trăm hoàn thành của toàn bộ chuyển nhượng
  • curl https://www.example.com/
    
    03 - Tổng kích thước của toàn bộ chuyển nhượng dự kiến
  • curl https://www.example.com/
    
    02 - Tỷ lệ phần trăm hoàn thành tải xuống
  • curl https://www.example.com/
    
    05 - Số lượng byte hiện đang tải xuống
  • curl https://www.example.com/
    
    02 - Tỷ lệ hoàn thành tải lên
  • curl https://www.example.com/
    
    07 - hiện đã tải lên số lượng byte
  • curl https://www.example.com/
    
    08 - Tốc độ chuyển trung bình của bản tải xuống
  • curl https://www.example.com/
    
    09 - Tốc độ truyền trung bình của tải lên
  • curl https://www.example.com/
    
    10 - Thời gian dự kiến ​​sẽ hoàn thành thao tác
  • curl https://www.example.com/
    
    11 - Thời gian trôi qua kể từ khi gọi
  • curl https://www.example.com/
    
    12 - Thời gian dự kiến ​​còn lại để hoàn thành
  • curl https://www.example.com/
    
    13 - Tốc độ chuyển trung bình trong 5 giây cuối cùng (5 giây đầu tiên của việc chuyển dựa trên thời gian ít hơn.)

Tùy chọn

curl https://www.example.com/
14 sẽ hiển thị một thanh tiến bộ hoàn toàn khác mà không cần giải thích nhiều!

Tốc độ giới hạn

Curl cho phép người dùng đặt các điều kiện tốc độ truyền phải được đáp ứng để cho phép chuyển tiếp. Bằng cách sử dụng công tắc

curl https://www.example.com/
15 và
curl https://www.example.com/
16, bạn có thể thực hiện chuyển tiền của Curl nếu tốc độ truyền thấp hơn giới hạn thấp nhất được chỉ định trong một thời gian xác định.

Để có Curl hủy bỏ tải xuống nếu tốc độ chậm hơn 3000 byte mỗi giây trong 1 phút, chạy:

curl ftp://ftp.funet.fi
8

Điều này có thể được sử dụng kết hợp với giới hạn thời gian tổng thể, do đó phải hoàn thành hoạt động trên trong vòng 30 phút:

curl ftp://ftp.funet.fi
9

Buộc Curl không chuyển dữ liệu nhanh hơn một tỷ lệ nhất định cũng có thể hữu ích nếu bạn đang sử dụng kết nối băng thông hạn chế và bạn không muốn chuyển giao của mình để sử dụng tất cả (đôi khi được gọi là van tiết lưu băng thông).

Làm cho dữ liệu chuyển curl không nhanh hơn 10 kilobyte mỗi giây:

curl dict://dict.org/m:curl
0

hoặc

curl dict://dict.org/m:curl
1

Hoặc ngăn Curl tải lên dữ liệu nhanh hơn 1 megabyte mỗi giây:

curl dict://dict.org/m:curl
2

Khi sử dụng tùy chọn

curl https://www.example.com/
17, tốc độ truyền được quy định trên cơ sở mỗi giây, điều này sẽ khiến tổng tốc độ truyền trở nên thấp hơn số đã cho. Đôi khi tất nhiên là thấp hơn đáng kể, nếu các gian hàng chuyển nhượng của bạn trong các thời gian.

Tập tin cấu hình

Curl tự động cố gắng đọc tệp

curl https://www.example.com/
18 (hoặc tệp
curl https://www.example.com/
19 trên Microsoft Windows Systems) từ Home Dir của người dùng khi khởi động.

Tệp cấu hình có thể được tạo ra bằng các công tắc dòng lệnh bình thường, nhưng bạn cũng có thể chỉ định các tùy chọn dài mà không cần dấu gạch ngang để làm cho nó dễ đọc hơn. Bạn có thể tách các tùy chọn và tham số với khoảng trắng hoặc với

curl https://www.example.com/
20 hoặc
curl https://www.example.com/
21. Nhận xét có thể được sử dụng trong tập tin. Nếu chữ cái đầu tiên trên một dòng là một ____ 222-symbol, phần còn lại của dòng được coi là một nhận xét.

Nếu bạn muốn tham số chứa khoảng trắng, bạn phải gửi lại toàn bộ tham số trong các trích dẫn kép (

curl https://www.example.com/
23). Trong các trích dẫn đó, bạn chỉ định một trích dẫn là
curl https://www.example.com/
24.

Lưu ý: Bạn phải chỉ định các tùy chọn và đối số của họ trên cùng một dòng.

Ví dụ, đặt thời gian mặc định và proxy trong tệp cấu hình:

curl dict://dict.org/m:curl
3

Không gian trắng có ý nghĩa ở cuối dòng, nhưng tất cả khoảng trắng dẫn đến các ký tự đầu tiên của mỗi dòng đều bị bỏ qua.

Ngăn Curl đọc tệp mặc định bằng cách sử dụng -Q làm tham số dòng lệnh đầu tiên, như:

curl dict://dict.org/m:curl
4

Buộc Curl để nhận và hiển thị trang trợ giúp cục bộ trong trường hợp nó được gọi mà không cần URL bằng cách tạo tệp cấu hình tương tự như:

curl dict://dict.org/m:curl
5

Bạn có thể chỉ định một tệp cấu hình khác sẽ được đọc bằng cách sử dụng cờ ________ 225/________ 226. Nếu bạn đặt tên tệp cấu hình thành

curl https://www.example.com/
27, nó sẽ đọc cấu hình từ Stdin, có thể tiện dụng nếu bạn muốn ẩn các tùy chọn không hiển thị trong các bảng quy trình, v.v.

curl dict://dict.org/m:curl
6

Khi sử dụng Curl trong các chương trình của riêng bạn, cuối cùng bạn có thể cần phải chuyển các tiêu đề tùy chỉnh của riêng mình khi nhận được một trang web. Bạn có thể làm điều này bằng cách sử dụng cờ

curl https://www.example.com/
28.

Ví dụ: Gửi tiêu đề

curl https://www.example.com/
29 đến máy chủ khi nhận được một trang:

curl dict://dict.org/m:curl
7

Điều này cũng có thể hữu ích trong trường hợp bạn muốn Curl gửi một văn bản khác trong tiêu đề so với bình thường. Tiêu đề

curl https://www.example.com/
28 mà bạn chỉ định sau đó thay thế Curl tiêu đề thường sẽ gửi. Nếu bạn thay thế một tiêu đề nội bộ bằng một tiêu đề trống, bạn ngăn tiêu đề đó được gửi. Để ngăn chặn tiêu đề
curl https://www.example.com/
31 được sử dụng:

curl dict://dict.org/m:curl
8

FTP và tên đường dẫn

Xin lưu ý rằng khi nhận các tệp có URL

curl https://www.example.com/
32, đường dẫn đã cho có liên quan đến thư mục bạn nhập. Để nhận tệp
curl https://www.example.com/
33 từ thư mục nhà của bạn tại trang web FTP của bạn, làm:

curl dict://dict.org/m:curl
9

Nếu bạn muốn tệp readme từ thư mục gốc của cùng một trang web đó, bạn cần chỉ định tên tệp tuyệt đối:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
0

(Tức là với một dấu gạch chéo thêm trước tên tệp.)

SFTP và SCP và tên đường dẫn

Với SFTP: và SCP: URL, tên đường dẫn được đưa ra là tên tuyệt đối trên máy chủ. Để truy cập một tệp liên quan đến thư mục nhà của người dùng từ xa, tiền tố tệp với

curl https://www.example.com/
34, chẳng hạn như:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
1

FTP và tường lửa

Giao thức FTP yêu cầu một trong các bên liên quan mở kết nối thứ hai ngay khi dữ liệu sắp được chuyển. Có hai cách để làm điều này.

Cách mặc định cho Curl là phát hành lệnh PASV khiến máy chủ mở một cổng khác và chờ kết nối khác được thực hiện bởi máy khách. Điều này là tốt nếu khách hàng đứng sau tường lửa không cho phép các kết nối đến.

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
2

Ví dụ, nếu máy chủ đứng sau tường lửa không cho phép các kết nối trên các cổng khác 21 (hoặc nếu nó không hỗ trợ lệnh

curl https://www.example.com/
35), cách khác để thực hiện nó là sử dụng lệnh
curl https://www.example.com/
36 và hướng dẫn máy chủ Để kết nối với máy khách trên số IP và cổng đã cho (làm tham số với lệnh cổng).

Cờ

curl https://www.example.com/
37 để Curl hỗ trợ một vài tùy chọn khác nhau. Máy của bạn có thể có một số địa chỉ IP và/hoặc giao diện mạng và Curl cho phép bạn chọn cách sử dụng. Địa chỉ mặc định cũng có thể được sử dụng:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
3

Tải xuống với

curl https://www.example.com/
36 nhưng sử dụng địa chỉ IP của giao diện
curl https://www.example.com/
39 của chúng tôi (điều này không hoạt động trên Windows):

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
4

Tải xuống với

curl https://www.example.com/
36 nhưng sử dụng 192.168.0.10 làm địa chỉ IP của chúng tôi để sử dụng:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
5

Giao diện mạng

Nhận một trang web từ một máy chủ bằng một cổng được chỉ định cho giao diện:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
6

hoặc

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
7

HTTPS

HTTP bảo mật yêu cầu thư viện TLS được cài đặt và sử dụng khi CORL được xây dựng. Nếu điều đó được thực hiện, Curl có khả năng truy xuất và đăng tài liệu bằng giao thức HTTPS.

Thí dụ:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
8

Curl cũng có khả năng sử dụng chứng chỉ máy khách để nhận/đăng tệp từ các trang web yêu cầu chứng chỉ hợp lệ. Hạn chế duy nhất là chứng chỉ cần phải ở định dạng PEM. PEM là một định dạng tiêu chuẩn và mở để lưu trữ chứng chỉ, nhưng nó không được sử dụng bởi các trình duyệt được sử dụng phổ biến nhất. Nếu bạn muốn Curl sử dụng các chứng chỉ bạn sử dụng với trình duyệt yêu thích của mình, bạn có thể cần tải xuống/biên dịch một trình chuyển đổi có thể chuyển đổi chứng chỉ được định dạng của trình duyệt của bạn thành các chứng chỉ được định dạng PEM.

Ví dụ về cách tự động truy xuất tài liệu bằng chứng chỉ bằng mật khẩu cá nhân:

curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/
9

Nếu bạn bỏ qua việc chỉ định mật khẩu trên dòng lệnh, bạn sẽ được nhắc về mật khẩu chính xác trước khi có thể nhận được bất kỳ dữ liệu nào.

Nhiều máy chủ HTTPS cũ có vấn đề với các phiên bản SSL hoặc TLS cụ thể mà các phiên bản mới hơn của OpenSSL, v.v.

curl ftps://files.are.secure.com/secrets.txt
0

Nếu không, Curl sẽ cố gắng sử dụng phiên bản mặc định TLS hợp lý.

Tiếp tục chuyển tập tin

Để tiếp tục chuyển tệp trong đó trước đó đã bị hủy bỏ, Curl hỗ trợ sơ yếu lý lịch trên các bản tải xuống của HTTP cũng như tải lên và tải xuống FTP.

Tiếp tục tải xuống một tài liệu:

curl ftps://files.are.secure.com/secrets.txt
1

Tiếp tục tải lên một tài liệu:

curl ftps://files.are.secure.com/secrets.txt
2

Tiếp tục tải xuống một tài liệu từ máy chủ web

curl ftps://files.are.secure.com/secrets.txt
3

Điều kiện thời gian

HTTP cho phép khách hàng chỉ định điều kiện thời gian cho tài liệu mà nó yêu cầu. Đó là

curl https://www.example.com/
41 hoặc
curl https://www.example.com/
42. Curl cho phép bạn chỉ định chúng bằng cờ ________ 243/________ 244.

Ví dụ: bạn có thể dễ dàng thực hiện tải xuống chỉ được thực hiện nếu tệp từ xa mới hơn một bản sao cục bộ. Nó sẽ được thực hiện như:

curl ftps://files.are.secure.com/secrets.txt
4

Hoặc bạn chỉ có thể tải xuống một tệp nếu tệp cục bộ mới hơn tệp từ xa. Làm điều này bằng cách chi tiêu chuỗi ngày với

curl https://www.example.com/
27, như trong:

curl ftps://files.are.secure.com/secrets.txt
5

Bạn có thể chỉ định một ngày văn bản đơn giản là điều kiện. Nói với Curl chỉ tải xuống tệp nếu nó được cập nhật kể từ ngày 12 tháng 1 năm 2012:

curl ftps://files.are.secure.com/secrets.txt
6

Curl chấp nhận một loạt các định dạng ngày. Bạn luôn thực hiện ngày kiểm tra cách khác bằng cách chuẩn bị cho nó bằng một dấu gạch ngang (

curl https://www.example.com/
27).

DIGN

Hãy thử vui

curl ftps://files.are.secure.com/secrets.txt
7

Bí danh cho

curl https://www.example.com/
47 là
curl https://www.example.com/
48 và
curl https://www.example.com/
49, và bí danh cho
curl https://www.example.com/
50 là
curl https://www.example.com/
51 và
curl https://www.example.com/
52. Ví dụ,

curl ftps://files.are.secure.com/secrets.txt
8

Các lệnh phá vỡ mô tả URL của RFC (nhưng không phải giao thức Dict) là

curl ftps://files.are.secure.com/secrets.txt
9

Hỗ trợ xác thực vẫn còn thiếu

LDAP

Nếu bạn đã cài đặt thư viện OpenLDAP, Curl có thể tận dụng nó và cung cấp hỗ trợ

curl https://www.example.com/
53. Trên Windows, Curl sẽ sử dụng WinLDAP từ nền tảng SDK theo mặc định.

Phiên bản giao thức mặc định được sử dụng bởi Curl là LDAP phiên bản 3. Phiên bản 2 sẽ được sử dụng làm cơ chế dự phòng trong trường hợp phiên bản 3 không kết nối.

LDAP là một điều phức tạp và viết một truy vấn LDAP không phải là một nhiệm vụ dễ dàng. Tôi khuyên bạn nên đào mô tả cú pháp cho nơi khác. Một nơi như vậy có thể là: RFC 2255, định dạng URL LDAP

Để chỉ cho bạn một ví dụ, đây là cách tôi có thể lấy tất cả mọi người từ máy chủ LDAP cục bộ của tôi có một miền phụ nhất định trong địa chỉ email của họ:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
0

Nếu tôi muốn có cùng thông tin ở định dạng HTML, tôi có thể lấy nó bằng cách không sử dụng cờ

curl https://www.example.com/
54 (thực thi ASCII).

Bạn cũng có thể sử dụng xác thực khi truy cập Danh mục LDAP:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
1

Theo mặc định, nếu người dùng và mật khẩu được cung cấp, OpenLDAP/WinLDAP sẽ sử dụng xác thực cơ bản. Trên Windows, bạn có thể kiểm soát hành vi này bằng cách cung cấp một trong các tùy chọn

curl https://www.example.com/
55,
curl https://www.example.com/
56 hoặc
curl https://www.example.com/
57 trong dòng lệnh Curl

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
2

Trên Windows, nếu không có người dùng/mật khẩu được chỉ định, cơ chế đàm phán tự động sẽ được sử dụng với thông tin đăng nhập hiện tại (SSPI/Spnego).

Biến môi trường

Curl đọc và hiểu các biến môi trường sau:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
3

Chúng nên được đặt cho các proxy dành riêng cho giao thức. Proxy chung nên được đặt với

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
4

Một danh sách các tên máy chủ được phân tách bằng dấu phẩy không nên thông qua bất kỳ proxy nào được đặt trong (chỉ có dấu hoa thị,

curl https://www.example.com/
58 khớp với tất cả các máy chủ)

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
5

Nếu tên máy chủ khớp với một trong các chuỗi này hoặc máy chủ nằm trong miền của một trong các chuỗi này, các giao dịch với nút đó sẽ không được thực hiện qua proxy. Khi một miền được sử dụng, nó cần bắt đầu với một khoảng thời gian. Người dùng có thể chỉ định rằng cả www.example.com và foo.example.com không nên sử dụng proxy bằng cách đặt

curl https://www.example.com/
59 thành
curl https://www.example.com/
60. Bằng cách bao gồm tên đầy đủ, bạn có thể loại trừ tên máy chủ cụ thể, vì vậy để tạo
curl https://www.example.com/
61 không sử dụng proxy nhưng vẫn có
curl https://www.example.com/
62 làm điều đó, đặt
curl https://www.example.com/
59 thành
curl https://www.example.com/
61.

Việc sử dụng cờ ________ 127/________ 126 ghi đè lên các biến môi trường.

NetRC

Unix đã giới thiệu khái niệm

curl https://www.example.com/
67 từ lâu. Đó là một cách để người dùng chỉ định tên và mật khẩu cho các trang web FTP thường được truy cập trong một tệp để bạn không phải nhập chúng trong mỗi khi bạn truy cập các trang web đó. Bạn nhận ra đây là một rủi ro bảo mật lớn nếu người khác nắm giữ mật khẩu của bạn, do đó, hầu hết các chương trình Unix sẽ không đọc tệp này trừ khi bạn chỉ có thể đọc được (mặc dù Curl không quan tâm).

Curl hỗ trợ các tệp

curl https://www.example.com/
67 nếu được nói đến (sử dụng các tùy chọn ________ 269/________ 270 và
curl https://www.example.com/
71). Điều này không được giới hạn chỉ trong FTP, vì vậy Curl có thể sử dụng nó cho tất cả các giao thức nơi sử dụng xác thực.

Một tệp

curl https://www.example.com/
67 đơn giản có thể trông giống như:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
6

Đầu ra tùy chỉnh

Để cho phép các lập trình viên tập lệnh tốt hơn để biết về tiến trình của Curl, tùy chọn ________ 273/________ 274 đã được giới thiệu. Sử dụng điều này, bạn có thể chỉ định thông tin nào từ lần chuyển trước đó bạn muốn trích xuất.

Để hiển thị số lượng byte được tải xuống cùng với một số văn bản và kết thúc mới:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
7

Chuyển Kerberos FTP

Curl hỗ trợ Kerberos4 và Kerberos5/GSSAPI để chuyển FTP. Bạn cần gói Kerberos được cài đặt và sử dụng tại thời gian xây dựng Curl để có sẵn.

Đầu tiên, hãy lấy vé KRB theo cách bình thường, như với công cụ ________ 275/________ 276. Sau đó sử dụng Curl theo cách tương tự như:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
8

Không có mục đích sử dụng mật khẩu trên công tắc

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
16, nhưng một cái trống sẽ khiến Curl yêu cầu một cái và bạn đã nhập mật khẩu thực vào ________ 275/________ 276.

Telnet

Hỗ trợ Telnet Curl là cơ bản và dễ sử dụng. Curl chuyển tất cả dữ liệu được truyền cho nó trên Stdin đến máy chủ từ xa. Kết nối với máy chủ telnet từ xa bằng dòng lệnh tương tự như:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt
9

Và nhập dữ liệu để chuyển đến máy chủ trên Stdin. Kết quả sẽ được gửi đến stdout hoặc đến tệp bạn chỉ định với

curl https://www.example.com/
80.

Bạn có thể muốn tùy chọn ________ 281/________ 282 để tắt đầu ra được đệm cho các kết nối chậm hoặc tương tự.

Truyền các tùy chọn cho đàm phán giao thức Telnet, bằng cách sử dụng tùy chọn

curl https://www.example.com/
83. Để nói với máy chủ, chúng tôi sử dụng thiết bị đầu cuối VT100, hãy thử một cái gì đó như:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
00

Các tùy chọn thú vị khác cho nó

curl https://www.example.com/
83 bao gồm:

  • curl https://www.example.com/
    
    85 Đặt vị trí hiển thị X.
  • curl https://www.example.com/
    
    86 Đặt một biến môi trường.

Lưu ý: Giao thức Telnet không chỉ định bất kỳ cách nào để đăng nhập với người dùng và mật khẩu được chỉ định để Curl không thể tự động thực hiện điều đó. Để làm điều đó, bạn cần theo dõi khi nhận được lời nhắc đăng nhập và gửi tên người dùng và mật khẩu phù hợp.

Kết nối liên tục

Chỉ định nhiều tệp trên một dòng lệnh duy nhất sẽ thực hiện chuyển tất cả chúng, từng tệp theo thứ tự được chỉ định.

LibCurl sẽ cố gắng sử dụng các kết nối liên tục để chuyển để chuyển thứ hai vào cùng một máy chủ có thể sử dụng cùng một kết nối đã được bắt đầu và bị bỏ mở trong lần chuyển trước đó. Điều này làm giảm đáng kể thời gian kết nối cho tất cả nhưng lần chuyển đầu tiên và nó sử dụng mạng tốt hơn nhiều.

Lưu ý rằng CURL không thể sử dụng các kết nối liên tục cho các chuyển khoản được sử dụng trong các máy bay Curl tiếp theo. Cố gắng nhồi càng nhiều URL càng tốt trên cùng một dòng lệnh nếu chúng đang sử dụng cùng một máy chủ, vì điều đó sẽ làm cho việc chuyển nhanh hơn. Nếu bạn sử dụng proxy HTTP để chuyển tệp, thực tế tất cả các chuyển khoản sẽ liên tục.

Nhiều lần chuyển với một dòng lệnh duy nhất

Như đã đề cập ở trên, bạn có thể tải xuống nhiều tệp với một dòng lệnh bằng cách thêm nhiều URL hơn. Nếu bạn muốn chúng được lưu vào tệp cục bộ thay vì chỉ được in vào stdout, bạn cần thêm một tùy chọn lưu cho mỗi URL bạn chỉ định. Lưu ý rằng điều này cũng dành cho tùy chọn

curl https://www.example.com/
87 (nhưng không phải
curl https://www.example.com/
88).

Ví dụ: Nhận hai tệp và sử dụng

curl https://www.example.com/
87 cho tên tệp thứ nhất và tùy chỉnh cho lần thứ hai:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
01

Bạn cũng có thể tải lên nhiều tệp theo cách tương tự:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
02

IPv6

Curl sẽ kết nối với máy chủ với IPv6 khi Tra cứu máy chủ trả về địa chỉ IPv6 và quay trở lại IPv4 nếu kết nối không thành công. Các tùy chọn

curl https://www.example.com/
90 và
curl https://www.example.com/
91 có thể chỉ định địa chỉ nào sẽ sử dụng khi cả hai đều có sẵn. Địa chỉ IPv6 cũng có thể được chỉ định trực tiếp trong URL bằng cú pháp:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
03

Khi kiểu này được sử dụng, tùy chọn

curl https://www.example.com/
92 phải được đưa ra để ngăn Curl giải thích các dấu ngoặc vuông như các ký tự toàn cầu đặc biệt. Liên kết các địa chỉ cục bộ và trang web địa phương bao gồm một định danh phạm vi, chẳng hạn như
curl https://www.example.com/
93, cũng có thể được sử dụng, nhưng phần phạm vi phải là số hoặc khớp với giao diện mạng hiện có trên Linux và phần trăm ký tự phải được thoát URL. Ví dụ trước trong URL SFTP có thể trông giống như:

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
04

Các địa chỉ IPv6 được cung cấp khác với các URL (ví dụ: các tùy chọn

curl "http://vm.tiktok.com/e9VDx8/" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7" -H "Cookie: _ga=GA1.2.213365735.1552156986; _gid=GA1.2.1717226934.1552319684; tt_webid=6667489497775638018" --compressed
26,
curl https://www.example.com/
95 hoặc
curl https://www.example.com/
96) không nên được mã hóa URL.

Danh sách mail

Để thuận tiện cho bạn, chúng tôi có một số danh sách gửi thư mở để thảo luận về Curl, sự phát triển của nó và những điều liên quan đến điều này. Nhận tất cả thông tin tại https://curl.se/mail/.

Vui lòng trực tiếp các câu hỏi Curl, yêu cầu tính năng và báo cáo sự cố cho một trong những danh sách gửi thư này thay vì gửi thư cho bất kỳ cá nhân nào.

Danh sách có sẵn bao gồm:

curl https://www.example.com/ 97

Người dùng của công cụ dòng lệnh. Cách sử dụng nó, những gì không hoạt động, các tính năng mới, các công cụ liên quan, câu hỏi, tin tức, cài đặt, tổng hợp, chạy, chuyển, v.v.

curl https://www.example.com/ 98

Các nhà phát triển sử dụng hoặc phát triển libcurl. Lỗi, tiện ích mở rộng, cải tiến.

curl https://www.example.com/ 99

Giao thông thấp. Chỉ nhận được thông báo của các phiên bản công cộng mới. Tệ nhất, điều đó tạo ra một cái gì đó như một hoặc hai thư mỗi tháng, nhưng thường chỉ có một thư mỗi tháng.

curl ftp://ftp.funet.fi/README 00

Sử dụng các hàm Curl trong PHP. Mọi thứ cuộn tròn với một góc PHP. Hoặc PHP với một góc cong.

curl ftp://ftp.funet.fi/README 01

Các tin tặc Python sử dụng Curl có hoặc không có pycurl ràng buộc python.