lunes, 15 de septiembre de 2014

Using cURL to automate HTTP jobs


with JSON:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource
with XML:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource
POST:
For posting data:
curl --data "param1=value1&param2=value2" http://hostname/resource
For file upload:
curl --form "fileupload=@filename.txt" http://hostname/resource
RESTful HTTP Post:
curl -X POST -d @filename http://hostname/resource
For logging into a site (auth):
curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login
curl -L -b headers http://localhost/
 

HTTP Scripting

1.1 Background
1.2 The HTTP Protocol
1.3 See the Protocol
1.4 See the Timing
1.5 See the Response

URL

2.1 Spec
2.2 Host
2.3 Port number
2.4 User name and password
2.5 Path part

Fetch a page

3.1 GET
3.2 HEAD

HTML forms

4.1 Forms explained
4.2 GET
4.3 POST
4.4 File Upload POST
4.5 Hidden Fields
4.6 Figure Out What A POST Looks Like

HTTP upload

5.1 PUT

HTTP Authentication

6.1 Basic Authentication
6.2 Other Authentication
6.3 Proxy Authentication
6.4 Hiding credentials

More HTTP Headers

7.1 Referer
7.2 User Agent

Redirects

8.1 Location header
8.2 Other redirects

Cookies

9.1 Cookie Basics
9.2 Cookie options

HTTPS

10.1 HTTPS is HTTP secure
10.2 Certificates

Custom Request Elements

11.1 Modify method and headers
11.2 More on changed methods

Web Login

12.1 Some login tricks

Debug

13.1 Some debug tricks

References

14.1 Standards
14.2 Sites
 

No hay comentarios:

Publicar un comentario