How can I make a [후] [1] 를 컬 요청을 명령줄 도구?
[1]: http://en.wikipedia.org/wiki/POST_% 28HTTP% 29
필드가 있는:
curl --data "param1=value1¶m2=value2" https://example.com/resource.cgi
지정된 필드가 있는 개별적으로:
curl --data "param1=value1" --data "param2=value2" https://example.com/resource.cgi
Multipart:
curl --form "[email protected]" https://example.com/resource.cgi
Multipart 필드가 있는 기적에의 파일_이름:
curl --form "[email protected];filename=desired-filename.txt" --form param1=value1 --form param2=value2 https://example.com/resource.cgi
데이터 없이.
curl --data '' https://example.com/resource.cgi
curl -X POST https://example.com/resource.cgi
curl --request POST https://example.com/resource.cgi
자세한 내용은 이 컬 수작업식. 이 컬 대한 자습서는 에뮬레이션 웹 브라우저 가 도움이 된다.
'함께' 폼 () 함수를 사용하여 curl_formadd 리바커우 구축해보십시오 제출하기 전에 일반적인 방법으로. 리바커우 문서용으로 에서 자세한 내용을 참조.
대용량 파일에 대한 추가 매개변수입니다 고려해보십시오 표시하십시오 업로드하십시오 진행율:
curl --tr-encoding -X POST -v -# -o output -T filename.dat \
http://example.com/resource.cgi
'이' -o 출력입니다 필요합니다, 그렇지 않으면 진행율 표시줄에는 나타납니다.
Restful HTTP POST 를 포함하는 XML:
>. http://example.com/path/to/resource -, - d '컬 - X 게시물로의 @filename.txt 헤더입니다 " Content-Type:text/xml".'
json 이 충족하거나 사용합니다.
>. http://example.com/path/to/resource -, - d '컬 - X 게시물로의 @filename.txt 헤더입니다 " Content-Type:application/json".'
이 파일의 내용을 읽을 것이며 '와 같은 이름이' 피렌임.t스트 게시물로의 요청을 보낸다.
예:
echo '{"text": "Hello **world**!"}' | curl -d @- https://api.github.com/markdown
출력:
<p>Hello <strong>world</strong>!</p>
curl -d "name=Rafael%20Sagula&phone=3320780" http://www.where.com/guest.cgi
예를 들면 [ 컬 예제에서와 수작업식 ] [1] 에서 찾을 수 있다.
curl -d "name=Rafael%20Sagula%26phone=3320780" http://www.where.com/guest.cgi
[1]: http://curl.haxx.se/docs/manpage.html # - d
사이트에 로그인할 경우, 다음과 같이 하십시오.
curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login
curl -L -b headers http://localhost/
첫 번째 절약합니다 요청 세션 쿠키 (제공되는 로그인 시) 에 headers" "; 절실해졌습니다. 지금부터 일부를 사용할 수 있는 웹 액세스 할 수 있는 쿠키 인증하십시오 로그인 후 있지만브라우저에 통해 일반적입니다.
curl -v --data-ascii var=value http://example.com
자세한 내용은 '컬 - 도움말에서는 옵션,' 체크 및 아주 많습니다.
게으른 얻을 수 있으며, 모든 작업을 할 경우 구글 크롬 당신꺼에요.
크롬 복제할지 모든 요청을 data-in 컬 구문.
크롬 데이터, & # 39 param1 world& # 39 는 ',' 보다 쉽게 읽을 수 있는 param2 =, = hello& 내말들어봐 사용하여 '또는' -f '-d 호스트당 매개변수입니다 단일 유형에 따라 게시물로의 reques 보낼 수 있는' 애플리케이션 '또는' 'multipart / / x 로렌코디드 korea. 양식 인컨텍스트 양식 데이터 그에 따라.
포스트 에드 '이 될 것 같은 응용 프로그램 / x 로렌코디드 korea. 양식' ( 사용되는 대부분의 양식 파일을 포함할 수 있는 t # 39, don& 업로드하는지 ):
<! - 모든 언어: > 랑 배시 -;
curl http://httpbin.org/post \
-H "User-Agent: Mozilla/2.2" \
-d param1=hello \
-d name=dinsdale
Multipart / 양식 데이터 사용하여 '대한' post '-f' ( 일반적으로 사용하는 포함된 양식을 파일 업로드 환경이나 order of fields) 은 여러 분야에서 중요한, 또는 같은 이름의 필요합니다 ):
curl http://httpbin.org/post \
-H "User-Agent: Mozilla/2.2" \
-F param1=hello \
-F name=dinsdale \
-F name=piranha
일반적으로, 이 것은 필요하지만, 사용자 에이전트 ',' < sup> 헤더입니다 I& # 39, ve 버린 그 만일에 대비하는거야. 모든 사용자 에이전트 설정되었습니다 않아도 됩니다 '~' 파일을 생성하여 요청 /.curlrc 포함된 '긴급 (u) (예: " Mozilla/2.2" < /sup>;;; '