Blog

Martes, 12 Marzo 2019 17:49

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

Written by 
Rate this item
(0 votes)

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/

Read 667 times

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.