Skip to main content

5 COMANDOS DO CURL PARA USAR NO DIA-A-DIA

O curl e uma ferramenta de linha de comando para manipulação de URL`s e transferência de dados. O principal benefício do cURL é que você pode usa-lo em arquivos .bat e linux shell-scripts para automatizar a manipulação de URL`s.

1. Lendo uma URL:

Leitura simples de uma URL
curl http://www.google.com.br


Salvar o conteúdo de um site para um arquivo. O comando abaixo salva a url http://www.meusite.com no arquivo meusite.html.
curl -o meusite.html http://www.meusite.com


Para que o cURL siga os redirects do site use a opção -L
curl -L  http://www.mysiteredirect.com


2. Lendo URL`s com parâmetros GET

curl  http://www.meusite.com?page=2&id=123


3. Lendo mais informações de uma URL

Exibir os cabeçalhos de uma URL:
curl --head http://www.meusite.com


4. Usando o cURL com FTP

Listando um diretório
curl  ftp://usuario:senha@meusite.com/diretorio/

Enviando Arquivos.
curl -T localfile.txt -u usuario:senha ftp://meusite.com/diretorio


5. Enviando dados via POST

curl -d "usuario=marcos&senha=123" http://meusite.com/login


6. Usnado o curl para fazer download de um arquivo

curl -LO http://www.meusite.com/arquivo.tgz

Comments

Popular posts from this blog

Installing PIP in OpenBSD 5.6

pip included with Python Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default [1], so you may have pip already. Install pip To install pip, securely download get-pip.py: #curl --remote-name https://bootstrap.pypa.io/get-pip.py Then run the following (which may require administrator access): #python get-pip.py If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you. To upgrade an existing setuptools (or distribute), run pip install -U setuptools.

Instalando Packet Tracer 6.3 no Fedora 23

Vamos começar... 1. Baixe o arquivo desse link:     http://www.deltaeridani.com/openssl-lib-compat-1.0.0i-1.fc20.i686.rpm 2. Baixe o Packet Tracer 6.3 do site netacad.com 3. Instale as seguintes dependencies:     dnf install libICE.i686 libpng libSM.i686 libX11.i686 libXext.i686 libXi.i686 libXrandr.i686 fontconfig.i686 libgcc.i686 glib.i686 compat-libstdc++-33.i686 libstdc++.i686 glib2.i686 libgthread-2.0.so.0 libglib-2.0.so.0 4. Instale usando o dnf o pacote que voce baixou no item 1:     dnf install openssl-lib-compat-1.0.0i-1.fc20.i686.rpm 5. Instalando o Packet Tracer 6.3:     tar xfvz PacketTracer63_linux.tar.gz     cd PacketTracer63/     sudo su     ./install     exit 6. Criando o atalho na área de trabalho ( Usando seu usuário padrão )     cp /opt/pt/art/app_student.png /usr/share/icons/     emacs /home/usua...

Configure BASH, KSH, TCSH, ZSH Shell To Logout User Automatically After Idle Time

You can configure any Linux system to automatically log users out after a period of inactivity. Simply login as the root user and create a file called /etc/profile.d/autologout.sh , enter: # vi /etc/profile.d/autologout.sh Append the following code: TMOUT=300 readonly TMOUT export TMOUT Save and close the file. Set permissions: # chmod +x /etc/profile.d/autologout.sh Above script will implement a 5 minute idle time-out for the default /bin/bash shell. You can also create tcsh version as follows: # vi /etc/profile.d/autologout.csh Append the following code: set -r autologout 5 Save and close the file. Set permissions, enter: # chmod +x /etc/profile.d/autologout.csh Dealing with ssh clients SSH allows administrators to set an idle timeout interval. After this interval has passed, the idle user will be automatically logged out. Open /etc/ssh/sshd config file, enter: # vi /etc/ssh/sshd config Find ClientAliveInterval and set to 300 (5 minutes) as follows: ...