Como configurar o cURL para usar sempre usar um proxy SOCKS?

2

Eu não quero ter que digitar curl --socks5 socks5://<proxy name>:<proxy port> <url> toda vez que eu quiser fazer uma solicitação para outro site. Como posso configurar o cURL para fazer isso por padrão?

    
por ssharma 11.02.2018 / 19:43

1 resposta

0

Como posso configurar o cURL para fazer isso por padrão?

Adicione a opção de comando ao arquivo de configuração curl :

Config file

You can easily end up with curl command lines that use a very large number of command-line options, making them rather hard to work with. Sometimes the length of the command line you want to enter even hits the maximum length your command-line system allows. The Microsoft Windows command prompt being an example of something that has a fairly small maximum line length.

To aid such situations, curl offers a feature we call "config file". It basically allows you to write command-line options in a text file instead and then tell curl to read options from that file in addition to the command line.

...

When curl is invoked, it always (unless -q is used) checks for a default config file and uses it if found. The file name it checks for is .curlrc on Unix-like systems and _curlrc on Windows.

The default config file is checked for in the following places in this order:

  1. curl tries to find the "home directory": It first checks for the CURL_HOME and then the HOME environment variables. Failing that, it uses getpwuid() on Unix-like systems (which returns the home directory given the current user in your system). On Windows, it then checks for the APPDATA variable, or as a last resort the %USERPROFILE%\Application Data.

  2. On Windows, if there is no _curlrc file in the home directory, it checks for one in the same directory the curl executable is placed. On Unix-like systems, it will simply try to load .curlrc from the determined home directory.

    
por 11.02.2018 / 20:02

Tags