14,974
edits
| Line 25: | Line 25: | ||
* '''Unsupported curl Options''': If you encounter an error like "curl: option --compressed: the installed libcurl version doesn't support this", it's a clear indication to remove or adjust the problematic option in the curl command. | * '''Unsupported curl Options''': If you encounter an error like "curl: option --compressed: the installed libcurl version doesn't support this", it's a clear indication to remove or adjust the problematic option in the curl command. | ||
== 如何解決 cUrl error (3) bad range in URL position xx == | |||
'''問題''' | |||
當使用 curl 下載包含特殊字符(如 `[]`)的 URL 時,你可能會遇到這個錯誤: | |||
<pre> | |||
curl: (3) bad range in URL position 33 | |||
</pre> | |||
'''解決方法''' | |||
將特殊字符轉換為 URL 編碼格式: | |||
<pre> | |||
# 錯誤示範 | |||
curl "https://example.com/api?param[0]=value" | |||
# 正確示範 | |||
curl "https://example.com/api?param%5B0%5D=value" | |||
</pre> | |||
常見的 URL 編碼對照: | |||
* `[` 轉換為 `%5B` | |||
* `]` 轉換為 `%5D` | |||
* 空格轉換為 `%20` | |||
'''說明''' | |||
* URL 規範要求某些特殊字符必須經過編碼才能使用 | |||
* 像 `[]` 這樣的字符在 URL 中有特殊含義,直接使用可能會導致解析錯誤 | |||
* URL 編碼確保這些特殊字符能被正確傳輸和解析 | |||
如果你不確定是否需要編碼,可以使用線上 URL 編碼工具進行轉換,例如:[https://www.urlencoder.org/ URL 線上編碼和解碼工具]。 | |||
== 如何解決 cUrl 錯誤 (#5): 不支援的代理語法 (Unsupported proxy syntax) == | == 如何解決 cUrl 錯誤 (#5): 不支援的代理語法 (Unsupported proxy syntax) == | ||