Print this page
Viernes, 17 Julio 2020 09:31

¿Cómo simular peticiones POST y GET desde el terminal de linux?

Escrito por 

PETICIONES GET:

Con JSON:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource

Con  XML:

curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource

 

PETICIONES POST

Para POST de parámetros

curl --data "param1=value1&param2=value2" http://hostname/resource

 

Para subida de ficheros:

curl --form "fileupload=@filename.txt" http://hostname/resource

 

RESTful HTTP Post:

curl -X POST -d @filename http://hostname/resource


Para loggear en una web (auth)

curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login

curl -L -b headers http://localhost/

Leer 5601 times
CNERIS.COM

Ultimas publicaciones de CNERIS.COM

Articulos relacionados

FaLang translation system by Faboba