# cURL

| **Comando**                                                                                                      | **Descrição**                                                   |
| ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `curl -h`                                                                                                        | menu de ajuda cURL                                              |
| `curl inlanefreight.com`                                                                                         | Solicitação GET básica                                          |
| `curl -s -O inlanefreight.com/index.html`                                                                        | ⇬ Fazer download do arquivo                                     |
| `curl -k https://inlanefreight.com`                                                                              | Ignorar a validação do certificado HTTPS (SSL)                  |
| `curl inlanefreight.com -v`                                                                                      | Imprimir detalhes completos da solicitação/resposta HTTP        |
| `curl -I https://www.inlanefreight.com`                                                                          | Enviar solicitação HEAD (imprime apenas cabeçalhos de resposta) |
| `curl -i https://www.inlanefreight.com`                                                                          | Imprimir cabeçalhos de resposta e corpo de resposta             |
| `curl https://www.inlanefreight.com -A 'Mozilla/5.0'`                                                            | Definir cabeçalho do agente do usuário                          |
| `curl -u admin:admin http://<SERVER_IP>:<PORT>/`                                                                 | Definir credenciais de autorização básica HTTP                  |
| `curl http://admin:admin@<SERVER_IP>:<PORT>/`                                                                    | Passe credenciais de autorização básica HTTP no URL             |
| `curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://<SERVER_IP>:<PORT>/`                                     | Definir cabeçalho da solicitação                                |
| `curl 'http://<SERVER_IP>:<PORT>/search.php?search=le'`                                                          | Passar parâmetros GET                                           |
| `curl -X POST -d 'username=admin&password=admin' http://<SERVER_IP>:<PORT>/`                                     | Enviar solicitação POST com dados POST                          |
| `curl -b 'PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/`                                      | Definir cookies de solicitação                                  |
| `curl -X POST -d '{"search":"london"}' -H 'Content-Type: application/json' http://<SERVER_IP>:<PORT>/search.php` | Enviar solicitação POST com dados JSON                          |

| `curl http://<SERVER_IP>:<PORT>/api.php/city/london`                                                                                                    | Ler entrada                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| `curl -s http://<SERVER_IP>:<PORT>/api.php/city/ \| jq`                                                                                                 | Leia todas as entradas        |
| `curl -X POST http://<SERVER_IP>:<PORT>/api.php/city/ -d '{"city_name":"HTB_City", "country_name":"HTB"}' -H 'Content-Type: application/json'`          | Criar (adicionar) entrada     |
| `curl -X PUT http://<SERVER_IP>:<PORT>/api.php/city/london -d '{"city_name":"New_HTB_City", "country_name":"HTB"}' -H 'Content-Type: application/json'` | Atualizar (modificar) entrada |
| `curl -X DELETE http://<SERVER_IP>:<PORT>/api.php/city/New_HTB_City`                                                                                    | Excluir entrada               |
