curl–get request with parameters
curl -d "os_username=name&os_password=pass" http://confluence.ccp.ccod.com:2220/pages/viewpage.action?pageId=20414893
curl-post request
curl -X POST -i -H 'content-type:application/json' -d '
{
"appKey": "ac5d5452",
"isNeedClearHistory": "0",
"isQuestionQuery": "0",
"msgId": "0",
"platformConnType": "1",
"protocolId": "5",
"query": "欢迎语后的用户问题",
"receiverId": "8169",
"robotHashCode": "3rach│a",
"sendTime": "123456789",
"talkerId": "10021",
"type": "voice",
"userId": "990xxx"
}
' http://47.95.6.82:8091/CSRBroker/queryAction\?rt\=1\&st\=2
Outbound call interface:
curl -H "Content-type:application/json" -X POST -i \
--data '{
"batchId": "12123",
"total": "1",
"data": [{
"nameListName": "testaa",
"entId": "2018103101",
"recordKey": "12345",
"custId": "12345",
"phoneNumbers":{
"phoneNumber1": "1234567890",
"phoneNumber2": "1234567890"
},
"exData1": ""
}]
}' http://zhaolian.ccod.io/dcmsDialerNew/qn/dialerHttpRequest/addCallRecodes
Example 2:
curl -H 'Authorization:/customWebservice/mvc/sessionDetail/queryByInsertTime.do?Nonce=23289&Timestamp-1555905046288&SecretId=AKIDz8krbsJ5yKBZQpn74WEkmLPx3gnPhESA' -X post -i
http:// ccod.mucfc.com/customWebservice/ mvc/sessionDetail/queryByInsertTime .do?entId=2018110101\&startTime=14515776000006&endTime=1514736000000&pageNum=1\&Signature=axwUtG+KX1PQEaxz42JQE3ztAG8=
HTTP/1.1 200 0K
Content-Type: application/j son; charset=UTE-8Date: Mon, 22 Apr 2019 05:24:01 GMTServer: Resin/4.0.13Content- Length: 45
{"result" :"PageTooBig", "code":"1", "pages":-1}
wget call post request
#!/bin/bash
wget --header 'content-type:application/json' --post-data '
{
"batchId": "121",
"total": "1",
"data": [{
"callListName": "testaa",
"entId": "20190423",
"recordKey": "2",
"custId": "12",
"phoneNumbers":{
"phoneNumber1": "17051010235",
"phoneNumber2": "12346552"
},
"exData1": ""
}]
}
' http://10.130.29.158/dcmsDialerNew/qn/dialerHttpRequest/addCallRecodes
---------------------------------------------------------
[dps@ccod131 bak]$ cat curl.sh
#!/bin/bash
curl -H "content-type:application/json" -X POST -i \
--data '{
"batchId": "121",
"total": "1",
"data": [{
"callListName": "testaa",
"entId": "20190423",
"recordKey": "2",
"custId": "12",
"phoneNumbers":{
"phoneNumber1": "17051010235",
"phoneNumber2": "12346552"
},
"exData1": ""
}]
}' http://10.130.29.158/dcmsDialerNew/qn/dialerHttpRequest/addCallRecodes
Reference link:
http://www.aiezu.com/system/linux/linux_curl_syntax.html
http://www.aiezu.com/system/linux/linux_curl_syntax.html
https://blog.csdn.net/lishe9452/article/details/79972203
https://blog.csdn.net/zx_water/article/details/78894199
1. Wget downloads the content of ftp:
wget --ftp-user=dev --ftp-password=dev ftp://10.130.41.160:21/tmp201811/mantis10202/dcmsDialerWebservic*
# 重命名下载
wget --ftp-user=dev --ftp-password=dev -o test11.war ftp://10.130.41.160:21/tmp201811/mantis10202/dcmsDialerWebservice-0.0.1-SNAPSHOT.war
- Support batch fuzzy path, batch download;
- Support ftp username secret download;
- -o Rename the downloaded file;
- -b background download
2. Curl downloads the content of ftp:
curl -O ftp://dev:[email protected]/tmp201811/mantis10202/dcmsDialerWebservice-0.0.1-SNAPSHOT.war
#重命名为dcmsdialerwebservice.war
curl -o dcmsdialerwebservice.war ftp://dev:[email protected]/tmp201811/mantis10202/dcmsDialerWebservice-0.0.1-SNAPSHOT.war
# 在本地生成文件时保存远程文件时间
[dps@ccod131 test]$ curl -o dcmsdialerwebservice1.war -R ftp://dev:[email protected]/tmp201811/mantis10202/dcmsDialerWebservice-0.0.1-SNAPSHOT.war
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 45.3M 100 45.3M 0 0 11.1M 0 0:00:04 0:00:04 --:--:-- 11.2M
[dps@ccod131 test]$ ll dcmsdialerwebservice1.war
-rw-rw-r-- 1 dps dps 47572111 11月 19 14:27 dcmsdialerwebservice1.war
## 直接显示
[dps@ccod131 test]$ curl -u dev:dev ftp://10.130.41.160/gitlabbackup/rename.sh
#!/bin/bash
dtrename=`date +%y%m%d`
Dir=/home/ftpsite/release/dev/gitlabbackup
dt=`date +%s -d "-1 day"`
dtremove=`date +%y%m%d -d "-1 month"`
dt2=`date +%s`
for subdir in `ls $Dir`; ##将该目录下的文件生成一个列表
do
if [ "${dt}_gitlab_backup.tar" \< "${subdir}" -a "${subdir}" \< "${dt2}_gitlab_backup.tar" ]; ##转义的小于
then
mv ${Dir}/${subdir} ${Dir}/${dtrename}.${subdir};
echo "The directory $Dir/${subdir} has been rename."
fi
done
# 不显示进度信息
curl -o dcmsdialerwebservice1.war -R --silent ftp://dev:[email protected]/tmp201811/mantis10202/dcmsDialerWebservice-0.0.1-SNAPSHOT.war
# 显示进度条(和默认的进度不一样)
[dps@ccod131 test]$ curl -o dcmsdialerwebservice1.war -R ftp://dev:[email protected]/tmp201811/mantis10202/dcmsDialerWebservice-0.0.1-SNAPSHOT.war --progress
######################################################################## 100.0%
- dev:dev means: user:pass
- Relative wget does not support wildcards
- -O/--remote-name write the output to the file, keep the file name of the remote file
- -o/--output write output to the file
- -R/--remote-time When generating files locally, keep remote file time
- Curl is displayed directly on the page, and wget downloads the file to the current directory. Therefore, if the file itself is a compressed package, it is not suitable for downloading using curl. Use curl to download files, use output redirection
- -s/–silent Silent mode. Do not output anything (curl outputs the downloaded file to stdout, and outputs the progress information to stderr, and does not display the progress information using the -silent option)
- --Progress and use --progress to display the progress bar
3. Curl uploads ftp files:
curl -T test.war ftp://dev:[email protected]/tmp201811/mantis10202/
## 上传文件到目录,若目录存在,创建目录
[dps@ccod131 test]$ curl -L ftp://dev:[email protected]/tmp201811/mantis10202/
-rw------- 1 504 505 47572111 Nov 19 06:27 dcmsDialerWebservice-0.0.1-SNAPSHOT.war
-rw------- 1 504 505 57646 Nov 19 06:32 传名单接口定义v3 .doc
-rw------- 1 504 505 82787 Nov 19 06:32 微众银行自动外拨定制接口部署文档.docx
[dps@ccod131 test]$ curl -T test.war --ftp-create-dirs ftp://dev:[email protected]/tmp201811/mantis10202/test/
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 45.3M 0 0 100 45.3M 0 11.1M 0:00:04 0:00:04 --:--:-- 11.2M
[dps@ccod131 test]$ curl -L ftp://dev:[email protected]/tmp201811/mantis10202/
-rw------- 1 504 505 47572111 Nov 19 06:27 dcmsDialerWebservice-0.0.1-SNAPSHOT.war
drwx------ 2 504 505 4096 Nov 20 09:17 test
-rw------- 1 504 505 57646 Nov 19 06:32 传名单接口定义v3 .doc
-rw------- 1 504 505 82787 Nov 19 06:32 微众银行自动外拨定制接口部署文档.docx
[dps@ccod131 test]$ curl -L ftp://dev:[email protected]/tmp201811/mantis10202/test/
-rw------- 1 504 505 47572111 Nov 20 09:17 test.war
- -T/--upload-file upload file
- dev:dev means user:passwd
- 10.130.41.160 means ip
- tmp201811/mantis10202/ indicates the path
- --Ftp-create-dirs If the remote directory does not exist, create a remote directory
4. Display all files in the current directory of ftp
[dps@ccod131 test]$ curl -L ftp://dev:[email protected]/tmp201811/mantis10202/
-rw------- 1 504 505 47572111 Nov 19 06:27 dcmsDialerWebservice-0.0.1-SNAPSHOT.war
-rw------- 1 504 505 57646 Nov 19 06:32 传名单接口定义v3 .doc
-rw------- 1 504 505 82787 Nov 19 06:32 微众银行自动外拨定制接口部署文档.docx
- -l/--list-only lists the file names in the ftp directory
Reference link:
- https://wangchujiang.com/linux-command/c/wget.html
- https://wangchujiang.com/linux-command/c/curl.html
- http://www.cnblogs.com/wainiwann/p/3492939.html