curl–パラメータを使用してリクエストを取得
curl -d "os_username=name&os_password=pass" http://confluence.ccp.ccod.com:2220/pages/viewpage.action?pageId=20414893
curl-postリクエスト
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
アウトバウンドコールインターフェイス:
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
例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コールポストリクエスト
#!/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
参照リンク:
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は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
- バッチファジーパス、バッチダウンロードをサポートします。
- ftpユーザー名シークレットダウンロードをサポートします。
- -oダウンロードしたファイルの名前を変更します。
- -bバックグラウンドダウンロード
2.Curlは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の意味:user:pass
- 相対wgetはワイルドカードをサポートしていません
- -O /-remote-name出力をファイルに書き込み、リモートファイルのファイル名を保持します
- -o /-出力書き込み出力をファイルに出力
- -R /-remote-timeファイルをローカルで生成する場合は、リモートファイル時間を保持します
- カールはページに直接表示され、wgetはファイルを現在のディレクトリにダウンロードします。したがって、ファイル自体が圧縮パッケージの場合、curlを使用したダウンロードには適していません。curlを使用してファイルをダウンロードし、出力リダイレクトを使用します
- -s / –サイレントサイレントモード。何も出力しないでください(curlはダウンロードしたファイルをstdoutに出力し、進行状況情報をstderrに出力し、-silentオプションを使用して進行状況情報を表示しません)
- --Progressおよび--progressを使用してプログレスバーを表示します
3.Curlはftpファイルをアップロードします。
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アップロードファイル
- dev:devはuser:passwdを意味します
- 10.130.41.160はIPを意味します
- tmp201811 / mantis10202 /はパスを示します
- --Ftp-create-dirsリモートディレクトリが存在しない場合は、リモートディレクトリを作成します
4.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-ftpディレクトリ内のファイル名のみを一覧表示します
参照リンク:
- https://wangchujiang.com/linux-command/c/wget.html
- https://wangchujiang.com/linux-command/c/curl.html
- http://www.cnblogs.com/wainiwann/p/3492939.html