Home  >  Article  >  php教程  >  Linux system curl command

Linux system curl command

高洛峰
高洛峰Original
2017-03-23 15:25:502043browse

curl command

curl -I URL //-I: Omit the source code to view, the content is as follows:

Linux system curl command

We are looking at the line HTTP/1.1 200 OK

Are there common states: 200 301 302 404 403 502 503

Among the above status codes, only 200 is OK

If 301 302 appears, it may be because a jump is set on the server side, the content is as follows:

Linux system curl command

The above picture shows the HTTP/1.1 301 setting Jump to the following: Location: http://www.aminglinux.com/bbs/forum.php

-x You can specify the ip and port, omitting to write hosts:

curl -x ip:port (port ) URL -I

curl -x61.135.157.156:80 www.qq.com -I

//( -I is used to only view the status code, not the source code, -x: proxy)

Linux system curl command

Linux system curl command

curl -Iv www.baidu.com //v: Display detailed information

Linux system curl command

User-Agent here: represents an identifier of the browser

curl -O URL (to download pictures) URL) //-O: Directly download the page or object

curl -o Custom name URL (the URL to download the image) //-o: Rename

Linux system curl command

curl -u user:password http:// 123.com //-u : Username and password can be specified

Related articles:

Use Curl command to view request response time method

Server-side PHP generates curl command line

Server-side PHP generates curl command OK

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:lamp architectureNext article:lamp architecture