使用curl提交表單

使用curl提交表單

請原諒我問這個簡單的問題......我以前沒有使用過curl。我正在嘗試從此表單自動下載一些數據:http://ida.water.usgs.gov/ida/available_records.cfm?sn=12040500

它發佈到 available_records_process.cfm。我會用:

curl -F "fromdate=1988-08-26;todate=2009-09-30;rtype=3;site_no=12040500" http://ida.water.usgs.gov/ida/available_records_process.cfm

但網站管理員對 available_records_process.cfm 的存取權限有限,因此我無法直接發佈到它(我收到「找不到指定的 URL」錯誤)。接下來,我嘗試在上一頁直接使用curl,例如:

curl -F "fromdate=1988-08-26;todate=2009-09-30;rtype=3" http://ida.water.usgs.gov/ida/available_records.cfm?sn=12040500

但這似乎並沒有發布表單,儘管嘗試了許多標誌和發布格式的變體。有什麼想法嗎?

答案1

您可能需要使用,--data-urlencode但這僅適用於POST請求。對於GET請求,您只需將由 分隔的參數附加&到 URL,例如...available_records.cfm?sn=12040500&fromdate=1988-08-26&todate=2009-09-30&rtype=3

相關內容