{"id":7205,"date":"2020-10-21T11:23:30","date_gmt":"2020-10-21T04:23:30","guid":{"rendered":"https:\/\/blog.tinohost.com\/?p=7205"},"modified":"2020-10-21T11:23:30","modified_gmt":"2020-10-21T04:23:30","slug":"curl-la-gi","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/curl-la-gi\/","title":{"rendered":"cURL l\u00e0 g\u00ec? T\u1ed5ng h\u1ee3p c\u00e1c l\u1ec7nh cURL Linux Command"},"content":{"rendered":"\n<p><strong>Khi s\u1eed d\u1ee5ng h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux \u0111\u1ec3 \u0111\u00e1p \u1ee9ng \u0111\u01b0\u1ee3c cho c\u00f4ng vi\u1ec7c l\u1eadp tr\u00ecnh c\u1ee7a m\u00ecnh, b\u1ea1n s\u1ebd g\u1eb7p l\u1ec7nh cURL. V\u1eady cURL l\u00e0 g\u00ec? Nh\u1eefng l\u1ec7nh cURL c\u01a1 b\u1ea3n v\u00e0 th\u00f4ng d\u1ee5ng? TinoHost s\u1ebd gi\u1ea3i \u0111\u00e1p gi\u00fap b\u1ea1n qua b\u00e0i vi\u1ebft n\u00e0y!<\/strong><\/p>\n\n\n<h2 id=\"cURL_l\u00e0_g\u00ec?\u00a0\"><b>cURL l\u00e0 g\u00ec?\u00a0<\/b><\/h2>\n\n\n<p><span style=\"font-weight: 400;\">cURL vi\u1ebft t\u1eaft c\u1ee7a <strong>Client URL<\/strong>. \u0110\u00e2y l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 d\u00f2ng l\u1ec7nh (command line tool) v\u00e0 th\u01b0 vi\u1ec7n d\u00f9ng \u0111\u1ec3 ki\u1ec3m tra k\u1ebft n\u1ed1i t\u1eeb URL v\u00e0 cho ph\u00e9p truy\u1ec1n d\u1eef li\u1ec7u th\u00f4ng qua nhi\u1ec1u giao th\u1ee9c kh\u00e1c nhau.&nbsp;<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">HTTP, HTTPS, FTP, FTPS, SCP, SFTP, FILE, IMAP, SMTP, POP3, &#8230; l\u00e0 nh\u1eefng giao th\u1ee9c cURL \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng th\u01b0\u1eddng xuy\u00ean.<\/span><\/p>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"600\" height=\"350\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/curl-la-gi-5-chuc-nang.jpg\" alt=\"curl-la-gi\" class=\"wp-image-15480\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/curl-la-gi-5-chuc-nang.jpg 600w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/curl-la-gi-5-chuc-nang-300x175.jpg 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/figure><\/div>\n\n\n<p><span style=\"font-weight: 400;\">cURL \u0111\u01b0\u1ee3c vi\u1ebft b\u1edfi Daniel Stenberg b\u1eb1ng C v\u00e0o n\u0103m 1997.&nbsp;<\/span><\/p>\n\n\n<h3 id=\"Ch\u1ee9c_n\u0103ng_c\u1ee7a_cURL\"><b>Ch\u1ee9c n\u0103ng c\u1ee7a cURL<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">Giao th\u1ee9c <a href=\"https:\/\/tino.vn\/blog\/request-va-response-trong-lap-trinh-web\/\" target=\"_blank\" rel=\"noreferrer noopener\">HTTP <\/a>gi\u00fap cURL h\u1ed7 tr\u1ee3 vi\u1ec7c g\u1eedi \u0111i m\u1ed9t request v\u1edbi t\u1ea5t c\u1ea3 c\u00e1c ph\u01b0\u01a1ng th\u1ee9c hi\u1ec7n c\u00f3 nh\u01b0 GET, POST, PUT, DELETE, &#8230;<\/span><\/p>\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">H\u1ed7 tr\u1ee3 ng\u01b0\u1eddi d\u00f9ng t\u1ea3i xu\u1ed1ng m\u00e1y m\u1ed9t trang web tr\u00ean m\u1ea1ng Internet. \u0110\u00e2y l\u00e0 m\u1ed9t trong nh\u1eefng ch\u1ee9c n\u0103ng c\u01a1 b\u1ea3n nh\u1ea5t c\u1ee7a cURL.&nbsp;<\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">V\u1eadn chuy\u1ec3n c\u00e1c t\u1eadp tin, h\u00ecnh \u1ea3nh, d\u1eef li\u1ec7u,\u2026 t\u1eeb n\u01a1i kh\u00e1c \u0111\u1ebfn m\u00e1y ch\u1ee7 ho\u1eb7c t\u1eeb m\u00e1y ch\u1ee7 \u0111\u1ebfn n\u01a1i kh\u00e1c.&nbsp;<\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">&nbsp;Ki\u1ec3m tra cookies n\u00e0o \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea3i tr\u00ean URL.<\/span><\/li><\/ul>\n\n\n<h2 id=\"4_b\u01b0\u1edbc_s\u1eed_d\u1ee5ng_cURL_PHP_c\u01a1_b\u1ea3n\"><b>4 b\u01b0\u1edbc s\u1eed d\u1ee5ng cURL PHP c\u01a1 b\u1ea3n<\/b><\/h2>\n\n\n<h3 id=\"B\u01b0\u1edbc_1:_Kh\u1edfi_t\u1ea1o_cURL\"><b>B\u01b0\u1edbc 1: Kh\u1edfi t\u1ea1o cURL<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">H\u00e0m s\u1eed d\u1ee5ng: <strong>curl_init ().<\/strong><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">B\u1ea1n s\u1ebd nh\u1eadn \u0111\u01b0\u1ee3c m\u1ed9t resource (m\u1ed9t ki\u1ec3u d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c \u0111\u1ecbnh ngh\u0129a trong <a href=\"https:\/\/tino.vn\/blog\/cach-su-dung-phpmyadmin\/\" target=\"_blank\" rel=\"noopener noreferrer\">PHP<\/a>) t\u1eeb h\u1ec7 th\u1ed1ng.<\/span><\/p>\n\n\n<h3 id=\"B\u01b0\u1edbc_2:_Thi\u1ebft_l\u1eadp_t\u00f9y_ch\u1ecdn_request\"><b>B\u01b0\u1edbc 2: Thi\u1ebft l\u1eadp t\u00f9y ch\u1ecdn request<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">H\u00e0m s\u1eed d\u1ee5ng: <strong>curl_setopt()<\/strong>. \u0110\u00e2y l\u00e0 h\u00e0m quan tr\u1ecdng \u0111\u1ec3 x\u1eed l\u00fd c\u00e1c d\u1eef li\u1ec7u \u0111\u1ea7u v\u00e0o. V\u00ed d\u1ee5 nh\u01b0: content-type, charset ho\u1eb7c gi\u00e1 tr\u1ecb cookies, giao th\u1ee9c HTTP,\u2026<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">C\u00e1c curl_setopt() b\u1eaft bu\u1ed9c ph\u1ea3i \u0111\u1ee9ng tr\u01b0\u1edbc curl_exec() th\u00ec m\u1edbi c\u00f3 t\u00e1c d\u1ee5ng.&nbsp;<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">Curl_setopt() th\u01b0\u1eddng s\u1ebd c\u00f3 3 tham s\u1ed1 \u0111\u1ea7u v\u00e0o:<\/span><\/p>\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">\u0110\u1ed1i t\u01b0\u1ee3ng cURL.<\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">T\u00ean c\u1ea5u h\u00ecnh.<\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Gi\u00e1 tr\u1ecb c\u1ee7a c\u1ea5u h\u00ecnh.<\/span><\/li><\/ul>\n\n\n<p><span style=\"font-weight: 400;\">C\u00e1c tham s\u1ed1 \u0111\u01b0\u1ee3c ng\u0103n c\u00e1ch v\u1edbi nhau b\u1eb1ng d\u1ea5u ph\u1ea9y. V\u00ed d\u1ee5: curl_setopt($ch, CURLOPT_URL, \u2018https:\/\/\/\u2019 ).<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">CURLOPT_URL, CURLOPT_RETURNTRANSFER, CURLOPT_TIMEOUT, CURLOPT_USERAGENT, CURLOPT_FILE, &#8230; l\u00e0 nh\u1eefng c\u1ea5u h\u00ecnh th\u00f4ng d\u1ee5ng v\u1edbi cURL.<\/span><\/p>\n\n\n<h3 id=\"B\u01b0\u1edbc_3:_Th\u1ef1c_thi\"><b>B\u01b0\u1edbc 3: Th\u1ef1c thi<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">H\u00e0m s\u1eed d\u1ee5ng: <strong>curl_exec()<\/strong>.<\/span><\/p>\n\n\n<h3 id=\"B\u01b0\u1edbc_4:_\u0110\u00f3ng_request,_gi\u1ea3i_ph\u00f3ng_t\u00e0i_nguy\u00ean\"><b>B\u01b0\u1edbc 4: \u0110\u00f3ng request, gi\u1ea3i ph\u00f3ng t\u00e0i nguy\u00ean<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">H\u00e0m s\u1eed d\u1ee5ng: <strong>curl_close()<\/strong>.&nbsp;<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u00f3ng request s\u1ebd gi\u00fap b\u1ea1n ti\u1ebft ki\u1ec7m \u0111\u00e1ng k\u1ec3 t\u00e0i nguy\u00ean c\u1ee7a h\u1ec7 th\u1ed1ng v\u00e0 n\u00e2ng cao hi\u1ec7u su\u1ea5t cho server.<\/span><\/p>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1000\" height=\"563\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/crr.jpg\" alt=\"curl-la-gi\" class=\"wp-image-15476\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/crr.jpg 1000w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/crr-300x169.jpg 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/crr-768x432.jpg 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/figure><\/div>\n\n\n<h2 id=\"T\u1ed5ng_h\u1ee3p_c\u00e1c_l\u1ec7nh_cURL_Linux_Command\"><b>T\u1ed5ng h\u1ee3p c\u00e1c l\u1ec7nh cURL<\/b> <b>Linux Command<\/b><\/h2>\n\n\n<h3 id=\"L\u1ec7nh_ki\u1ec3m_tra_phi\u00ean_b\u1ea3n_cURL\"><b>L\u1ec7nh ki\u1ec3m tra phi\u00ean b\u1ea3n cURL<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p: cURL trong <a href=\"https:\/\/tino.vn\/blog\/he-dieu-hanh-linux-la-gi\/\" target=\"_blank\" rel=\"noopener noreferrer\">Linux<\/a> c\u00f3 c\u00fa ph\u00e1p: <code>curl [OPTIONS] [URL]<\/code><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">T\u00e1c d\u1ee5ng: gi\u00fap b\u1ea1n bi\u1ebft \u0111\u01b0\u1ee3c cURL \u0111\u00e3 \u0111\u01b0\u1ee3c c\u00e0i \u0111\u1eb7t hay ch\u01b0a, ph\u00f9 h\u1ee3p v\u1edbi giao th\u1ee9c n\u00e0o. L\u1ec7nh ki\u1ec3m tra phi\u00ean b\u1ea3n cURL th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 hi\u1ec3n th\u1ecb n\u1ed9i dung tr\u00ean trang.&nbsp;<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: n\u1ebfu mu\u1ed1n xem n\u1ed9i dung c\u1ee7a trang yourdomain.com, b\u1ea1n c\u1ea7n s\u1eed d\u1ee5ng c\u00fa ph\u00e1p: <strong>curl yourdomain.com<\/strong>. H\u1ec7 th\u1ed1ng s\u1ebd render (k\u1ebft xu\u1ea5t) cho b\u1ea1n m\u00e3 ngu\u1ed3n trang ch\u1ee7 c\u1ee7a domain n\u00e0y.\u00a0<\/span><\/p>\n\n\n<h3 id=\"D\u00f9ng_cURL_Command_\u0111\u1ec3_t\u1ea3i_file\"><b>D\u00f9ng cURL Command \u0111\u1ec3 t\u1ea3i file<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">T\u00e1c d\u1ee5ng: d\u00f9ng \u0111\u1ec3 t\u1ea3i m\u1ed9t d\u1eef li\u1ec7u t\u1eeb m\u00e1y ch\u1ee7 \u1edf xa.&nbsp;<\/span><\/p>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/images-1.jpg\" alt=\"Images 1\" class=\"wp-image-15499\" width=\"705\" height=\"373\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/images-1.jpg 308w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/images-1-300x159.jpg 300w\" sizes=\"(max-width: 705px) 100vw, 705px\" \/><\/figure><\/div>\n\n\n<p>C\u00f3 2 c\u00e1ch thao t\u00e1c:<\/p>\n\n\n<p><b>C\u00e1ch 1:<\/b><span style=\"font-weight: 400;\"> L\u01b0u file tr\u00ean folder hi\u1ec7n h\u00e0nh. T\u00ean file download xu\u1ed1ng gi\u1ed1ng v\u1edbi t\u00ean file t\u1eeb xa.<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p: <code>curl -O http:\/\/yourdomain.com\/yourfile.tar.gz<\/code><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">D\u00f9ng c\u00e1ch n\u00e0y, file s\u1ebd \u0111\u01b0\u1ee3c l\u01b0u v\u1edbi t\u00ean<\/span><b> yourfile.tar.gz.<\/b><\/p>\n\n\n<p><b>C\u00e1ch 2: <\/b><span style=\"font-weight: 400;\">Cho ph\u00e9p t\u00f9y ch\u1ecdn t\u00ean file v\u00e0 \u0111\u01b0\u1eddng d\u1eabn l\u01b0u tr\u1eef.<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p: <code>curl -o newyourfile.tar.gz http:\/\/yourdomain.com\/yourfile.tar.gz<\/code><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">D\u00f9ng c\u00e1ch n\u00e0y, file s\u1ebd \u0111\u01b0\u1ee3c l\u01b0u v\u1edbi t\u00ean m\u1edbi l\u00e0 <\/span><b>newyourfile.tar.gz<\/b><\/p>\n\n\n<h3 id=\"L\u1ec7nh_HTTP_cURL_Command\"><b>L\u1ec7nh HTTP cURL Command<\/b><\/h3>\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng nh\u01b0 m\u1ed9t server proxy \u0111\u1ec3 t\u1ea3i file. C\u00fa ph\u00e1p: <code>curl -x&nbsp; sampleproxy.com:8090 -U username:password -O http:\/\/ testdomain.com\/testfile.tar.gz<\/code><\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Ki\u1ec3m tra th\u00f4ng tin header c\u1ee7a web HTTP. C\u00e2u l\u1ec7nh th\u1ef1c hi\u1ec7n: <code>curl -I www.yourdomain.com<\/code><\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">G\u1eedi y\u00eau c\u1ea7u GET v\u00e0 POST:&nbsp;<\/span><\/li><\/ul>\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p GET request: <code>curl http:\/\/mydomain.com<\/code><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p POST request: <code>curl \u2013data \u201ctext=Howareyou\u201d https:\/\/mydomain.com\/firstpage.jsp<\/code><\/span><\/p>\n\n\n<h3 id=\"L\u1ec7nh_cURL_cho_Cookies\"><b>L\u1ec7nh cURL<\/b> <b>cho Cookies<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">T\u00e1c d\u1ee5ng: ki\u1ec3m tra c\u00e1c cookies n\u00e0o \u0111\u01b0\u1ee3c t\u1ea3i tr\u00ean URL<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p: <code>curl --cookie-jar Mycookies.txt https:\/\/www.samplewebsite.com \/index.html -O<\/code><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">N\u1ebfu c\u00f3 s\u1eb5n cookies trong file, b\u1ea1n c\u00f3 th\u1ec3 upload n\u00f3 l\u00ean website. C\u00e2u l\u1ec7nh \u00e1p d\u1ee5ng:&nbsp;<\/span><\/p>\n\n\n<p><code><span style=\"font-weight: 400;\">curl --cookie Mycookies.txt https:\/\/www. samplewebsite.com<\/span><\/code><\/p>\n\n\n<h3 id=\"L\u1ec7nh_cURL_cho_FTP\"><b>L\u1ec7nh cURL cho FTP<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 t\u1ea3i file t\u1eeb m\u00e1y ch\u1ee7 t\u1eeb xa, b\u1ea1n d\u00f9ng c\u00e2u l\u1ec7nh: <code>curl -u username:password -O ftp:\/\/nameftpserver\/yourfile.tar.gz<\/code><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 t\u1ea3i file l\u00ean m\u00e1y ch\u1ee7 FTP, b\u1ea1n d\u00f9ng c\u00e2u l\u1ec7nh: <code>curl -u username:password -T yourfile.tar.gz ftp:\/\/nameftpserver<\/code><\/span><\/p>\n\n\n<h3 id=\"H\u00e0m_cURL_thi\u1ebft_l\u1eadp_t\u00f9y_ch\u1ecdn_c\u00f9ng_l\u00fac\"><b>H\u00e0m cURL thi\u1ebft l\u1eadp t\u00f9y ch\u1ecdn c\u00f9ng l\u00fac<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">N\u1ebfu mu\u1ed1n th\u1ef1c hi\u1ec7n nhi\u1ec1u thi\u1ebft l\u1eadp t\u00f9y ch\u1ecdn c\u00f9ng l\u00fac, b\u1ea1n n\u00ean s\u1eed d\u1ee5ng h\u00e0m curl_setopt_array().&nbsp;<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">C\u1ea5u tr\u00fac ho\u00e0n ch\u1ec9nh c\u1ee7a h\u00e0m curl_setopt_array() s\u1ebd c\u00f3 d\u1ea1ng nh\u01b0 sau:<\/span><\/p>\n\n\n<pre class=\"wp-block-preformatted lang:default decode:true prettyprinted\"><span class=\"pln\">curl_setopt_array<\/span><span class=\"pun\">(<\/span><span class=\"pln\">$curl<\/span><span class=\"pun\">,<\/span><span class=\"pln\"> array<\/span><span class=\"pun\">(<\/span><span class=\"pln\">\nCURLOPT_RETURNTRANSFER <\/span><span class=\"pun\">=&gt;<\/span> <span class=\"lit\">1<\/span><span class=\"pun\">,<\/span><span class=\"pln\">\nCURLOPT_URL <\/span><span class=\"pun\">=&gt;<\/span> <span class=\"str\">'https:\/\/\/'<\/span><span class=\"pun\">,<\/span><span class=\"pln\">\nCURLOPT_USERAGENT <\/span><span class=\"pun\">=&gt;<\/span> <span class=\"str\">'Exmaple POST'<\/span><span class=\"pun\">,<\/span><span class=\"pln\">\nCURLOPT_POST <\/span><span class=\"pun\">=&gt;<\/span> <span class=\"lit\">1<\/span><span class=\"pun\">,<\/span><span class=\"pln\">\nCURLOPT_POSTFIELDS <\/span><span class=\"pun\">=&gt;<\/span><span class=\"pln\"> http_build_query<\/span><span class=\"pun\">(<\/span><span class=\"pln\">array<\/span><span class=\"pun\">(<\/span>\n<span class=\"str\">'email'<\/span> <span class=\"pun\">=&gt;<\/span> <span class=\"str\">'sydney@fife'<\/span><span class=\"pun\">,<\/span>\n<span class=\"str\">'password'<\/span> <span class=\"pun\">=&gt;<\/span> <span class=\"str\">'pistol'<\/span>\n<span class=\"pun\">))<\/span><\/pre>\n\n\n<h3 id=\"L\u1ec7nh_gi\u1edbi_h\u1ea1n_output_c\u1ee7a_cURL\"><b>L\u1ec7nh gi\u1edbi h\u1ea1n output c\u1ee7a cURL<\/b><\/h3>\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p: <code>curl --limit-rate 100K http:\/\/testdomain.com\/samplefile.tar.gz -O<\/code><\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">C\u00e2u l\u1ec7nh n\u00e0y \u0111\u00e3 gi\u1edbi h\u1ea1n b\u0103ng th\u00f4ng t\u1ea3i xu\u1ed1ng l\u00e0 100K.<\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">Gi\u1edbi h\u1ea1n b\u0103ng th\u00f4ng s\u1ebd h\u1ea1n ch\u1ebf t\u00ecnh tr\u1ea1ng&nbsp; dung l\u01b0\u1ee3ng file qu\u00e1 l\u1edbn khi\u1ebfn m\u00e1y download ch\u1eadm, ngh\u1ebdn m\u1ea1ng,\u2026<\/span><\/p>\n\n\n<p><strong>M\u1ed9t s\u1ed1 l\u1ec7nh Curl kh\u00e1c <\/strong>b\u1ea1n c\u00f3 th\u1ec3 tham kh\u1ea3o trong \u1ea3nh:<\/p>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1000\" height=\"600\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/cr.png\" alt=\"curl-la-gi\" class=\"wp-image-15475\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/cr.png 1000w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/cr-300x180.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/06\/cr-768x461.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/figure><\/div>\n\n\n<p>Qua b\u00e0i vi\u1ebft n\u00e0y, TinoHost hi v\u1ecdng \u0111\u00e3 cung c\u1ea5p \u0111\u01b0\u1ee3c nh\u1eefng ki\u1ebfn th\u1ee9c h\u1eefu \u00edch b\u1ed5 sung cho b\u1ea1n. Ch\u00fac b\u1ea1n th\u00e0nh c\u00f4ng tr\u00ean con \u0111\u01b0\u1eddng l\u1eadp tr\u00ecnh \u0111\u00e3 ch\u1ecdn!<\/p>\n\n\n<h2 id=\"Nh\u1eefng_c\u00e2u_h\u1ecfi_th\u01b0\u1eddng_g\u1eb7p_v\u1ec1_cURL\"><b>Nh\u1eefng c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 cURL<\/b><\/h2>\n\n\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"\u0110\u1ec3_d\u00f9ng_cURL_trong_PHP,_c\u1ea7n_chu\u1ea9n_b\u1ecb_nh\u1eefng_g\u00ec?\">\u0110\u1ec3 d\u00f9ng cURL trong PHP, c\u1ea7n chu\u1ea9n b\u1ecb nh\u1eefng g\u00ec?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 d\u00f9ng cURL trong PHP, h\u1ec7 th\u1ed1ng c\u1ee7a b\u1ea1n c\u1ea7n c\u00f3:<\/span><\/p>\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">B\u1ed9 th\u01b0 vi\u1ec7n libcurl c\u1ee7a PHP.&nbsp;<\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Th\u01b0 vi\u1ec7n&nbsp; LibcURL \u0111\u00e3 \u0111\u01b0\u1ee3c t\u00edch h\u1ee3p s\u1eb5n tr\u00ean c\u00e1c package c\u00e0i \u0111\u1eb7t PHP nh\u01b0 XAMPP, WAMP, MAMP. N\u1ebfu b\u1ea1n d\u00f9ng c\u00e1c package n\u00e0y, b\u1ea1n c\u00f3 th\u1ec3 y\u00ean t\u00e2m s\u1eed d\u1ee5ng m\u00e0 kh\u00f4ng c\u1ea7n c\u00e0i \u0111\u1eb7t.&nbsp;<\/span><\/li><\/ul>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"T\u1ea3i_nhi\u1ec1u_file_b\u1eb1ng_cURL_nh\u01b0_th\u1ebf_n\u00e0o?\">T\u1ea3i nhi\u1ec1u file b\u1eb1ng cURL nh\u01b0 th\u1ebf n\u00e0o?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 t\u1ea3i nhi\u1ec1u file, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng l\u1ec7nh sau:<\/span><\/p>\n\n\n<p><code><span style=\"font-weight: 400;\">curl -O http:\/\/yourdomain.com\/yourfile.tar.gz -O http:\/\/mydomain.com\/myfile.tar.gz<\/span><\/code><\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"L\u1ec7nh_xem_to\u00e0n_b\u1ed9_l\u1ec7nh_cURL?\">L\u1ec7nh xem to\u00e0n b\u1ed9 l\u1ec7nh cURL?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>\u0110\u1ec3 c\u00f3 th\u1ec3 xem to\u00e0n b\u1ed9 l\u1ec7nh trong cURL, b\u1ea1n nh\u1eadp l\u1ec7nh: man curl. <\/p>\n\n\n<p>N\u1ebfu kh\u00f4ng s\u1eb5n c\u00f3 h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux, b\u1ea1n c\u00f3 th\u1ec3 truy c\u1eadp v\u00e0o <a href=\"https:\/\/curl.se\/docs\/manpage.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">link n\u00e0y<\/a> \u0111\u1ec3 xem to\u00e0n b\u1ed9 l\u1ec7nh cURL.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"cURL_v\u00e0_Curl_c\u00f3_g\u00ec_kh\u00e1c_nhau?\">cURL v\u00e0 Curl c\u00f3 g\u00ec kh\u00e1c nhau?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>Ch\u00fang kh\u00e1c nhau \u1edf m\u1eb7t tr\u00ecnh b\u00e0y vi\u1ebft hoa v\u00e0 ng\u1eef ngh\u0129a.<\/p>\n\n\n<ul class=\"wp-block-list\"><li><strong>cURL <\/strong>l\u00e0 t\u00ean ban \u0111\u1ea7u c\u1ee7a Curl, nh\u1ea5n m\u1ea1nh s\u1ef1 li\u00ean quan v\u1edbi URL.<\/li><li><strong>Curl <\/strong>l\u00e0 t\u00ean v\u1ec1 sau c\u1ee7a Curl.<\/li><\/ul>\n\n\n<p>B\u1ea1n c\u00f3 th\u1ec3 tr\u00ecnh b\u00e0y b\u1eb1ng c\u1ea3 2 c\u00e1ch vi\u1ebft n\u00e0y, tuy nhi\u00ean trong v\u0103n b\u1ea3n c\u1ee7a b\u1ea1n n\u00ean th\u1ed1ng nh\u1ea5t s\u1eed d\u1ee5ng 1 th\u00ecnh th\u1ee9c.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\n<script type=\"application\/ld+json\">\n\t{\n\t\t\"@context\": \"https:\/\/schema.org\",\n\t\t\"@type\": \"FAQPage\",\n\t\t\"mainEntity\": [\n\t\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"\u0110\u1ec3 d\u00f9ng cURL trong PHP, c\u1ea7n chu\u1ea9n b\u1ecb nh\u1eefng g\u00ec?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>\u0110\u1ec3 d\u00f9ng cURL trong PHP, h\u1ec7 th\u1ed1ng c\u1ee7a b\u1ea1n c\u1ea7n c\u00f3:<\/p><ul><li>B\u1ed9 th\u01b0 vi\u1ec7n libcurl c\u1ee7a PHP.&nbsp;<\/li><li>Th\u01b0 vi\u1ec7n&nbsp; LibcURL \u0111\u00e3 \u0111\u01b0\u1ee3c t\u00edch h\u1ee3p s\u1eb5n tr\u00ean c\u00e1c package c\u00e0i \u0111\u1eb7t PHP nh\u01b0 XAMPP, WAMP, MAMP. N\u1ebfu b\u1ea1n d\u00f9ng c\u00e1c package n\u00e0y, b\u1ea1n c\u00f3 th\u1ec3 y\u00ean t\u00e2m s\u1eed d\u1ee5ng m\u00e0 kh\u00f4ng c\u1ea7n c\u00e0i \u0111\u1eb7t.&nbsp;<\/li><\/ul>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"T\u1ea3i nhi\u1ec1u file b\u1eb1ng cURL nh\u01b0 th\u1ebf n\u00e0o?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>\u0110\u1ec3 t\u1ea3i nhi\u1ec1u file, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng l\u1ec7nh sau:<\/p><p>curl -O http:\/\/yourdomain.com\/yourfile.tar.gz -O http:\/\/mydomain.com\/myfile.tar.gz<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"L\u1ec7nh xem to\u00e0n b\u1ed9 l\u1ec7nh cURL?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>\u0110\u1ec3 c\u00f3 th\u1ec3 xem to\u00e0n b\u1ed9 l\u1ec7nh trong cURL, b\u1ea1n nh\u1eadp l\u1ec7nh: man curl. <\/p><p>N\u1ebfu kh\u00f4ng s\u1eb5n c\u00f3 h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux, b\u1ea1n c\u00f3 th\u1ec3 truy c\u1eadp v\u00e0o <a>link n\u00e0y<\/a> \u0111\u1ec3 xem to\u00e0n b\u1ed9 l\u1ec7nh cURL.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"cURL v\u00e0 Curl c\u00f3 g\u00ec kh\u00e1c nhau?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Ch\u00fang kh\u00e1c nhau \u1edf m\u1eb7t tr\u00ecnh b\u00e0y vi\u1ebft hoa v\u00e0 ng\u1eef ngh\u0129a.<\/p><ul><li><strong>cURL <\/strong>l\u00e0 t\u00ean ban \u0111\u1ea7u c\u1ee7a Curl, nh\u1ea5n m\u1ea1nh s\u1ef1 li\u00ean quan v\u1edbi URL.<\/li><li><strong>Curl <\/strong>l\u00e0 t\u00ean v\u1ec1 sau c\u1ee7a Curl.<\/li><\/ul><p>B\u1ea1n c\u00f3 th\u1ec3 tr\u00ecnh b\u00e0y b\u1eb1ng c\u1ea3 2 c\u00e1ch vi\u1ebft n\u00e0y, tuy nhi\u00ean trong v\u0103n b\u1ea3n c\u1ee7a b\u1ea1n n\u00ean th\u1ed1ng nh\u1ea5t s\u1eed d\u1ee5ng 1 th\u00ecnh th\u1ee9c.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t]\n\t}\n<\/script>\n\n\n<p>M\u1ecdi th\u1eafc m\u1eafc v\u00e0 g\u00f3p \u00fd li\u00ean quan, xin vui l\u00f2ng <a href=\"https:\/\/tinohost.com\/lien-he\/\" target=\"_blank\" class=\"rank-math-link\" rel=\"noopener\">li\u00ean h\u1ec7 ngay TinoHost<\/a> \u0111\u1ec3 \u0111\u01b0\u1ee3c t\u01b0 v\u1ea5n chi ti\u1ebft ho\u1eb7c <a href=\"https:\/\/www.facebook.com\/tinohostdotcom\/\" target=\"_blank\" class=\"rank-math-link\" rel=\"noopener nofollow\">Fanpage<\/a> \u0111\u1ec3 c\u1eadp nh\u1eadt nh\u1eefng th\u00f4ng tin m\u1edbi nh\u1ea5t nh\u00e9!<\/p>\n\n\n<p>V\u1edbi b\u1ec1 d\u00e0y kinh nghi\u1ec7m h\u01a1n 5 n\u0103m cung c\u1ea5p hosting, d\u1ecbch v\u1ee5 cho thu\u00ea m\u00e1y ch\u1ee7, c\u00e1c d\u1ecbch v\u1ee5 li\u00ean quan \u0111\u1ebfn t\u00ean mi\u1ec1n v\u00e0 b\u1ea3o m\u1eadt website, h\u00e3y \u0111\u1ec3 TinoHost \u0111\u1ed3ng h\u00e0nh c\u00f9ng b\u1ea1n tr\u00ean con \u0111\u01b0\u1eddng kh\u1eb3ng \u0111\u1ecbnh th\u01b0\u01a1ng hi\u1ec7u tr\u00ean b\u1ea3n \u0111\u1ed3 c\u00f4ng ngh\u1ec7 to\u00e0n c\u1ea7u!<\/p>\n\n\n<p><\/p>\n\n\n<ul class=\"wp-block-list\"><li><br \/><\/li><li><br \/><\/li><li><a href=\"https:\/\/tinohost.com\/\" target=\"_blank\" class=\"rank-math-link\" rel=\"noopener\"><\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Khi s\u1eed d\u1ee5ng h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux \u0111\u1ec3 \u0111\u00e1p \u1ee9ng \u0111\u01b0\u1ee3c cho c\u00f4ng vi\u1ec7c l\u1eadp tr\u00ecnh c\u1ee7a m\u00ecnh, b\u1ea1n s\u1ebd g\u1eb7p l\u1ec7nh cURL. V\u1eady cURL l\u00e0 g\u00ec? Nh\u1eefng l\u1ec7nh cURL c\u01a1 b\u1ea3n v\u00e0 th\u00f4ng d\u1ee5ng? TinoHost s\u1ebd gi\u1ea3i \u0111\u00e1p gi\u00fap b\u1ea1n qua b\u00e0i vi\u1ebft n\u00e0y! cURL l\u00e0 g\u00ec?\u00a0 cURL vi\u1ebft t\u1eaft c\u1ee7a Client URL. \u0110\u00e2y [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":16021,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5404],"tags":[5630],"class_list":["post-7205","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webmasters","tag-curl"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/7205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=7205"}],"version-history":[{"count":0,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/7205\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/16021"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=7205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=7205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=7205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}