curl command
curl command
curl command is the most commonly used server-side debugging command interface, not one
- GET curl test interfaces
curl http://www.baidu.com
url parameter may be directly written to the url, url case preferably enclosed in quotes
curl 'http://115.28.108.130:5000/add/?a=1&b=2'
- Post request form class
curl can-d
request data designated (contains-d
parameter defaults to request Post), as
curl 'http://115.28.108.130:5000/api/user/login/' \
-d 'name=张三&password=123456'
- Post request JSON format
curl may be a-H
specified header, a plurality of header to use a plurality of-H
(
curl 'http://115.28.108.130:5000/api/user/reg/' \
-H 'Content-type: application/json' \
-d '{"name":"张三三","password": 123456}'
- Request with the Cookie
Cookie belong to a header, we can carry to crawl to the Cookie request interface requires a login, such as:
curl 'http://115.28.108.130:5000/api/user/getUserList/' \
-H 'Cookie:PYSESSID=05eac6ba-2eb6-11e9-a130-00163e06e52c;session=eyIwNWVhYzZiYS0yZWI2LTExZTktYTEzMC0wMDE2M2UwNmU1MmMiOnRydWV9.D0Q51A.u9XjrAZb-plUSl01QnNPkGXJPck'
You can use
-v
the parameters to view the request details
- Other requests PUT / DELETE and the like may be used
-X
to specify the request method
curl -X PUT 'http://.....'