Berikut contoh-contoh penggunaan cURL secara sederhana yang sering digunakan
1. With fields
curl --data "param1=value1¶m2=value2" https://example.com/resource.cgi
2. Multipartcurl --form "fileupload=@my-file.txt" https://example.com/resource.cgi
3. Multipart with filecurl --form "fileupload=@my-file.txt;filename=desired-filename.txt" --form param1=value1 --form param2=value2 https://example.com/resource.cgi
4. Without datacurl --data '' https://example.com/resource.cgi
curl -X POST https://example.com/resource.cgi
curl --request POST https://example.com/resource.cgi
Untuk file yang cukup besar, coba gunakan sintaks berikut untuk menampilkan proses upload:
curl --tr-encoding -X POST -v -# -o output -T filename.dat \
http://example.com/resource.cgi
Catatan: -o output perlu dituliskan dalam parameter, kalau tidak, proses upload tidak akan tampil.Referensi: https://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request
0 comments:
Post a Comment