cURL - How To Use
cURL - How To Use
curl.1themanpage
NAME Related:
Manual
curltransferaURL FAQ
HTTPScripting
SYNOPSIS
curl[options][URL...]
DESCRIPTION
curlisatooltotransferdatafromortoaserver,usingoneofthesupportedprotocols
(DICT,FILE,FTP,FTPS,GOPHER,HTTP,HTTPS,IMAP,IMAPS,LDAP,LDAPS,POP3,
POP3S,RTMP,RTSP,SCP,SFTP,SMB,SMBS,SMTP,SMTPS,TELNETandTFTP).
Thecommandisdesignedtoworkwithoutuserinteraction.
curloffersabusloadofusefultrickslikeproxysupport,userauthentication,FTPupload,
HTTPpost,SSLconnections,cookies,filetransferresume,Metalink,[Link]
willseebelow,thenumberoffeatureswillmakeyourheadspin!
[Link](3)fordetails.
URL
[Link]'llfindadetaileddescriptioninRFC3986.
YoucanspecifymultipleURLsorpartsofURLsbywritingpartsetswithinbracesasin:
[Link]
oryoucangetsequencesofalphanumericseriesbyusing[]asin:
[Link]
[Link]
[Link]
Nestedsequencesarenotsupported,butyoucanuseseveralonesnexttoeachother:
[Link]
[Link] 1/51
28/04/2016 cURLHowToUse
[Link]
sequentialmannerinthespecifiedorder.
YoucanspecifyastepcounterfortherangestogeteveryNthnumberorletter:
[Link]
[Link]
Whenusing[]or{}sequenceswheninvokedfromacommandlineprompt,youprobably
[Link]
alsogoesforothercharacterstreatedspecial,likeforexample'&','?'and'*'.
ProvidetheIPv6zoneindexintheURLwithanescapedpercentagesignandthe
[Link]
[Link]
IfyouspecifyURLwithoutprotocol://prefix,curlwillattempttoguesswhatprotocolyou
[Link]
[Link],forhostnamesstartingwith"ftp."curlwillassumeyouwant
tospeakFTP.
[Link]
syntacticallycorrectURLbyanymeansbutisinsteadveryliberalwithwhatitaccepts.
curlwillattempttoreuseconnectionsformultiplefiletransfers,sothatgettingmanyfiles
fromthesameserverwillnotdomultipleconnects/[Link]
coursethisisonlydoneonfilesspecifiedonasinglecommandlineandcannotbeused
betweenseparatecurlinvokes.
PROGRESSMETER
curlnormallydisplaysaprogressmeterduringoperations,indicatingtheamountof
transferreddata,transferspeedsandestimatedtimeleft,etc.
curldisplaysthisdatatotheterminalbydefault,soifyouinvokecurltodoanoperation
anditisabouttowritedatatotheterminal,itdisablestheprogressmeterasotherwiseit
wouldmessuptheoutputmixingprogressmeterandresponsedata.
IfyouwantaprogressmeterforHTTPPOSTorPUTrequests,youneedtoredirectthe
responseoutputtoafile,usingshellredirect(>),o[file]orsimilar.
ItisnotthesamecaseforFTPuploadasthatoperationdoesnotspitoutanyresponse
datatotheterminal.
Ifyoupreferaprogress"bar"insteadoftheregularmeter,#isyourfriend.
OPTIONS
[Link]
tothem.
Theshort"singledash"formoftheoptions,dforexample,maybeusedwithorwithouta
[Link] 2/51
28/04/2016 cURLHowToUse
spacebetweenitanditsvalue,[Link]
"doubledash"form,dataforexample,requiresaspacebetweenitanditsvalue.
Shortversionoptionsthatdon'tneedanyadditionalvaluescanbeusedimmediatelynext
toeachother,likeforexampleyoucanspecifyalltheoptionsO,Landvatonceas
OLv.
Ingeneral,allbooleanoptionsareenabledwithoptionandyetagaindisabledwithno
[Link],youusetheexactsameoptionnamebutprefixitwith"no".However,in
thislistwemostlyonlylistandshowtheoptionversionofthem.(Thisconceptwithno
[Link]/offonrepeateduse
ofthesamecommandlineoption.)
#,progressbar
Makecurldisplayprogressasasimpleprogressbarinsteadofthestandard,more
informational,meter.
:,next
TellscurltouseaseparateoperationforthefollowingURLandassociatedoptions.
ThisallowsyoutosendseveralURLrequests,eachwiththeirownspecificoptions,
forexample,suchasdifferentusernamesorcustomrequestsforeach.(Addedin
7.36.0)
0,http1.0
(HTTP)TellscurltouseHTTPversion1.0insteadofusingitsinternallypreferred:
HTTP1.1.
http1.1
(HTTP)[Link].(Added
in7.33.0)
http2
(HTTP)[Link]
libcurlwasbuilttosupportit.(Addedin7.33.0)
http2priorknowledge
(HTTP)TellscurltoissueitsnonTLSHTTPrequestsusingHTTP/2without
HTTP/[Link]/2
[Link]/2thestandardwaywithnegotiated
protocolversionintheTLShandshake.
HTTP/2supportingeneralalsorequiresthattheunderlyinglibcurlwasbuilttosupport
it.(Addedin7.49.0)
nonpn
[Link]
SSLlibrarythatsupportsNPN.NPNisusedbyalibcurlthatsupportsHTTP2to
negotiateHTTP2supportwiththeserverduringhttpssessions.
[Link] 3/51
28/04/2016 cURLHowToUse
(Addedin7.36.0)
noalpn
[Link]
anSSLlibrarythatsupportsALPN.ALPNisusedbyalibcurlthatsupportsHTTP2to
negotiateHTTP2supportwiththeserverduringhttpssessions.
(Addedin7.36.0)
1,tlsv1
(SSL)[Link].
Youcanuseoptionstlsv1.0,tlsv1.1,andtlsv1.2tocontroltheTLSversionmore
precisely(iftheSSLbackendinusesupportssuchalevelofcontrol).
2,sslv2
(SSL)ForcescurltouseSSLversion2whennegotiatingwitharemoteSSLserver.
SometimescurlisbuiltwithoutSSLv2support.SSLv2iswidelyconsideredinsecure
(seeRFC6176).
3,sslv3
(SSL)ForcescurltouseSSLversion3whennegotiatingwitharemoteSSLserver.
SometimescurlisbuiltwithoutSSLv3support.SSLv3iswidelyconsideredinsecure
(seeRFC7568).
4,ipv4
ThisoptiontellscurltoresolvenamestoIPv4addressesonly,andnotforexampletry
IPv6.
6,ipv6
ThisoptiontellscurltoresolvenamestoIPv6addressesonly,andnotforexampletry
IPv4.
a,append
(FTP/SFTP)Whenusedinanupload,thismakescurlappendtothetargetfileinstead
[Link]'texist,[Link]
ignoredbysomeSFTPservers(includingOpenSSH).
A,useragent<agentstring>
(HTTP)[Link]
CGIsfailifthisfieldisn'tsetto"Mozilla/4.0".Toencodeblanksinthestring,surround
[Link],headeroptionof
course.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
anyauth
(HTTP)Tellscurltofigureoutauthenticationmethodbyitself,andusethemost
[Link] 4/51
28/04/2016 cURLHowToUse
[Link]
checkingtheresponseheaders,thuspossiblyinducinganextranetworkroundtrip.
Thisisusedinsteadofsettingaspecificauthenticationmethod,whichyoucando
withbasic,digest,ntlm,andnegotiate.
Notethatusinganyauthisnotrecommendedifyoudouploadsfromstdin,sinceit
[Link]
needshouldarisewhenuploadingfromstdin,theuploadoperationwillfail.
b,cookie<name=data>
(HTTP)[Link]
previouslyreceivedfromtheserverina"SetCookie:"[Link]
format"NAME1=VALUE1NAME2=VALUE2".
Ifno'='symbolisusedintheline,itistreatedasafilenametousetoreadpreviously
storedcookielinesfrom,[Link]
thismethodalsoactivatesthecookieenginewhichwillmakecurlrecordincoming
cookiestoo,whichmaybehandyifyou'reusingthisincombinationwiththeL,
[Link]
headers(SetCookiestyle)ortheNetscape/Mozillacookiefileformat.
Thefilespecifiedwithb,[Link]
[Link],usethec,cookiejaroption.
[Link]
usetheNAME1=VALUE1format,orinafileusetheSetCookieformatanddon't
specifyadomain,thenthecookieissentforanydomain(evenafterredirectsare
followed)[Link]
enabledandaserversetsacookieofthesamenamethenbothwillbesentona
futuretransfertothatserver,[Link]
setadomaininSetCookie(doingthatwillincludesubdomains)orusetheNetscape
format.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
B,useascii
(FTP/LDAP)[Link],thiscanalsobeenforcedbyusingan
URLthatendswith"type=A".Thisoptioncausesdatasenttostdouttobeintext
modeforwin32systems.
basic
(HTTP)[Link]
defaultandthisoptionisusuallypointless,unlessyouuseittooverrideapreviously
setoptionthatsetsadifferentauthenticationmethod(suchasntlm,digest,or
negotiate).
Usedtogetherwithu,userandx,proxy.
Seealsoproxybasic.
c,cookiejar<filename>
(HTTP)Specifytowhichfileyouwantcurltowriteallcookiesafteracompleted
[Link] 5/51
28/04/2016 cURLHowToUse
[Link]
cookiesreceivedfromremoteserver(s).Ifnocookiesareknown,nodatawillbe
[Link]
nametoasingledash,"",thecookieswillbewrittentostdout.
Thiscommandlineoptionwillactivatethecookieenginethatmakescurlrecordand
[Link],cookieoption.
Ifthecookiejarcan'tbecreatedorwrittento,thewholecurloperationwon'tfailor
[Link],butthatistheonly
visiblefeedbackyougetaboutthispossiblylethalsituation.
Since7.43.0cookiesthatwereimportedintheSetCookieformatwithoutadomain
namearenotexportedbythisoption.
Ifthisoptionisusedseveraltimes,thelastspecifiedfilenamewillbeused.
C,continueat<offset>
Continue/[Link]
exactnumberofbytesthatwillbeskipped,countingfromthebeginningofthesource
[Link],theFTPserver
commandSIZEwillnotbeusedbycurl.
Use"C"totellcurltoautomaticallyfindoutwhere/[Link]
thenusesthegivenoutput/inputfilestofigurethatout.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
ciphers<listofciphers>
(SSL)[Link]
[Link]:
[Link]
[Link]
ciphersisintheNSSCipherSuiteentryatthisURL:
[Link]
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
compressed
(HTTP)Requestacompressedresponseusingoneofthealgorithmscurlsupports,
[Link]
unsupportedencoding,curlwillreportanerror.
connecttimeout<seconds>
Maximumtimeinsecondsthatyouallowcurl'[Link]
connectionphase,soifcurlconnectswithinthegivenperioditwillcontinueifnotit
willexit.Sinceversion7.32.0,thisoptionacceptsdecimalvalues.
Seealsothem,maxtimeoption.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
[Link] 6/51
28/04/2016 cURLHowToUse
createdirs
Whenusedinconjunctionwiththeooption,curlwillcreatethenecessarylocal
[Link]
option,[Link]
exist,nodirwillbecreated.
TocreateremotedirectorieswhenusingFTPorSFTP,tryftpcreatedirs.
crlf
[Link](OS/390).
(SMTPaddedin7.40.0)
crlfile<file>
(HTTPS/FTPS)ProvideafileusingPEMformatwithaCertificateRevocationListthat
mayspecifypeercertificatesthataretobeconsideredrevoked.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
(Addedin7.19.7)
d,data<data>
(HTTP)SendsthespecifieddatainaPOSTrequesttotheHTTPserver,inthesame
waythatabrowserdoeswhenauserhasfilledinanHTMLformandpressesthe
[Link]
typeapplication/[Link],form.
d,[Link]
aspecialinterpretationofthe@[Link],youshould
[Link]
mayusedataurlencode.
Ifanyoftheseoptionsisusedmorethanonceonthesamecommandline,thedata
piecesspecifiedwillbemergedtogetherwithaseparating&[Link],using'd
name=danieldskill=lousy'wouldgenerateapostchunkthatlookslike
'name=daniel&skill=lousy'.
Ifyoustartthedatawiththeletter@,therestshouldbeafilenametoreadthedata
from,[Link]
[Link]'foobar'wouldthusbedonewithdata
@[Link],carriagereturnsand
[Link]'twantthe@charactertohaveaspecial
interpretationusedatarawinstead.
D,dumpheader<file>
Writetheprotocolheaderstothespecifiedfile.
ThisoptionishandytousewhenyouwanttostoretheheadersthatanHTTPsite
[Link]
invocationbyusingtheb,cookieoption!Thec,cookiejaroptionisabetterway
tostorecookies.
[Link] 7/51
28/04/2016 cURLHowToUse
WhenusedinFTP,theFTPserverresponselinesareconsideredbeing"headers"
andthusaresavedthere.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
dataascii<data>
Seed,data.
databinary<data>
(HTTP)Thispostsdataexactlyasspecifiedwithnoextraprocessingwhatsoever.
Ifyoustartthedatawiththeletter@,[Link]
asimilarmannerasdataasciidoes,exceptthatnewlinesandcarriagereturnsare
preservedandconversionsareneverdone.
Ifthisoptionisusedseveraltimes,theonesfollowingthefirstwillappenddataas
describedind,data.
dataraw<data>
(HTTP)Thispostsdatasimilarlytodatabutwithoutthespecialinterpretationofthe
@[Link],data.(Addedin7.43.0)
dataurlencode<data>
(HTTP)Thispostsdata,similartotheotherdataoptionswiththeexceptionthatthis
performsURLencoding.(Addedin7.18.0)
TobeCGIcompliant,the<data>partshouldbeginwithanamefollowedbya
[Link]<data>partcanbepassedtocurlusing
oneofthefollowingsyntaxes:
content
[Link]
thatthecontentdoesn'tcontainany=or@symbols,asthatwillthenmakethe
syntaxmatchoneoftheothercasesbelow!
=content
[Link]=
symbolisnotincludedinthedata.
name=content
[Link]
namepartisexpectedtobeURLencodedalready.
@filename
Thiswillmakecurlloaddatafromthegivenfile(includinganynewlines),URL
encodethatdataandpassitoninthePOST.
name@filename
[Link] 8/51
28/04/2016 cURLHowToUse
Thiswillmakecurlloaddatafromthegivenfile(includinganynewlines),URL
[Link]
appended,resultinginname=[Link]
expectedtobeURLencodedalready.
delegationLEVEL
SetLEVELtotelltheserverwhatitisallowedtodelegatewhenitcomestouser
[Link]/kerberos.
none
Don'tallowanydelegation.
policy
DelegatesifandonlyiftheOKASDELEGATEflagissetintheKerberosservice
ticket,whichisamatterofrealmpolicy.
always
Unconditionallyallowtheservertodelegate.
digest
(HTTP)[Link]
[Link]
combinationwiththenormalu,[Link]
alsontlm,negotiateandanyauthforrelatedoptions.
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.
disableeprt
(FTP)TellcurltodisabletheuseoftheEPRTandLPRTcommandswhendoing
[Link],thenLPRT
beforeusingPORT,butwiththisoption,[Link]
areextensionstotheoriginalFTPprotocol,andmaynotworkonallservers,butthey
enablemorefunctionalityinabetterwaythanthetraditionalPORTcommand.
eprtcanbeusedtoexplicitlyenableEPRTagainandnoeprtisanaliasfor
disableeprt.
IftheserverisanIPv6host,thisoptionwillhavenoeffectasEPRTisnecessary
then.
[Link]
modeyouneedtonotuseP,ftpportorforceitwithftppasv.
disableepsv
(FTP)TellcurltodisabletheuseoftheEPSVcommandwhendoingpassiveFTP
[Link],butwith
thisoption,itwillnottryusingEPSV.
epsvcanbeusedtoexplicitlyenableEPSVagainandnoepsvisanaliasfor
[Link] 9/51
28/04/2016 cURLHowToUse
disableepsv.
IftheserverisanIPv6host,thisoptionwillhavenoeffectasEPSVisnecessary
then.
[Link]
modeyouneedtouseP,ftpport.
dnsinterface<interface>
TellcurltosendoutgoingDNSrequeststhrough<interface>.Thisoptionisa
counterparttointerface(whichdoesnotaffectDNS).Thesuppliedstringmustbean
interfacename(notanaddress).
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
[Link].(Addedin7.33.0)
dnsipv4addr<ipaddress>
Tellcurltobindto<ipaddress>whenmakingIPv4DNSrequests,sothattheDNS
requestsoriginatefromthisaddress.TheargumentshouldbeasingleIPv4address.
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
[Link].(Addedin7.33.0)
dnsipv6addr<ipaddress>
Tellcurltobindto<ipaddress>whenmakingIPv6DNSrequests,sothattheDNS
requestsoriginatefromthisaddress.TheargumentshouldbeasingleIPv6address.
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
[Link].(Addedin7.33.0)
dnsservers<ipaddress,ipaddress>
[Link]
[Link]
givenas:<portnumber>aftereachIPaddress.
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
[Link].(Addedin7.33.0)
e,referer<URL>
(HTTP)Sendsthe"ReferrerPage"[Link]
setwiththeH,[Link],locationyoucanappend
"auto"totherefererURLtomakecurlautomaticallysetthepreviousURLwhenit
followsaLocation:[Link]"auto"stringcanbeusedalone,evenifyoudon'tset
aninitialreferer.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
E,cert<certificate[:password]>
(SSL)Tellscurltousethespecifiedclientcertificatefilewhengettingafilewith
HTTPS,[Link]#12
[Link] 10/51
28/04/2016 cURLHowToUse
formatifusingSecureTransport,[Link]
optionalpasswordisn'tspecified,[Link]
optionassumesa"certificate"filethatistheprivatekeyandtheclientcertificate
concatenated!Seecertandkeytospecifythemindependently.
IfcurlisbuiltagainsttheNSSSSLlibrarythenthisoptioncantellcurlthenicknameof
thecertificatetousewithintheNSSdatabasedefinedbytheenvironmentvariable
SSL_DIR(orbydefault/etc/pki/nssdb).IftheNSSPEMPKCS#11module
([Link])[Link]
fromthecurrentdirectory,pleaseprecedeitwith"./"prefix,inordertoavoidconfusion
[Link]":",itneedstobeprecededby"\"sothatit
[Link]"\",itneedstobe
escapedas"\\"sothatitisnotrecognizedasanescapecharacter.
(iOSandMacOSXonly)IfcurlisbuiltagainstSecureTransport,thenthecertificate
stringcaneitherbethenameofacertificate/privatekeyinthesystemoruser
keychain,orthepathtoaPKCS#[Link]
touseafilefromthecurrentdirectory,pleaseprecedeitwith"./"prefix,inorderto
avoidconfusionwithanickname.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
engine<name>
[Link]
[Link](ornone)oftheengines
maybeavailableatruntime.
environment
(RISCOSONLY)Setsarangeofenvironmentvariables,usingthenamesthew
optionsupports,toalloweasierextractionofusefulinformationafterhavingruncurl.
egdfile<file>
(SSL)[Link]
[Link]
option.
expect100timeout<seconds>
(HTTP)Maximumtimeinsecondsthatyouallowcurltowaitfora100continue
responsewhencurlemitsanExpects:[Link]
[Link]!Whencurlstops
waiting,itwillcontinueasiftheresponsehasbeenreceived.
(Addedin7.47.0)
certtype<type>
(SSL)[Link],DERand
[Link],PEMisassumed.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
cacert<CAcertificate>
[Link] 11/51
28/04/2016 cURLHowToUse
(SSL)[Link]
[Link](s)[Link]
curlisbuilttouseadefaultfileforthis,sothisoptionistypicallyusedtoalterthat
defaultfile.
curlrecognizestheenvironmentvariablenamed'CURL_CA_BUNDLE'ifitisset,and
[Link].
ThewindowsversionofcurlwillautomaticallylookforaCAcertsfilenamedcurlca
[Link],[Link],orintheCurrentWorking
Directory,orinanyfolderalongyourPATH.
IfcurlisbuiltagainsttheNSSSSLlibrary,theNSSPEMPKCS#11module
([Link])needstobeavailableforthisoptiontoworkproperly.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
capath<CAcertificatedirectory>
(SSL)[Link]
pathscanbeprovidedbyseparatingthemwith":"(e.g."path1:path2:path3").The
certificatesmustbeinPEMformat,andifcurlisbuiltagainstOpenSSL,thedirectory
musthavebeenprocessedusingthec_rehashutilitysuppliedwithOpenSSL.Using
capathcanallowOpenSSLpoweredcurltomakeSSLconnectionsmuchmore
efficientlythanusingcacertifthecacertfilecontainsmanyCAcertificates.
Ifthisoptionisset,thedefaultcapathvaluewillbeignored,andifitisusedseveral
times,thelastonewillbeused.
pinnedpubkey<pinnedpublickey(hashes)>
(SSL)Tellscurltousethespecifiedpublickeyfile(orhashes)[Link]
canbeapathtoafilewhichcontainsasinglepublickeyinPEMorDERformat,or
anynumberofbase64encodedsha256hashesprecededbysha256//and
separatedby
WhennegotiatingaTLSorSSLconnection,theserversendsacertificateindicating
[Link]
matchthepublickeyprovidedtothisoption,curlwillaborttheconnectionbefore
sendingorreceivinganydata.
PEM/DERsupport:7.39.0:OpenSSL,GnuTLSandGSKit7.43.0:NSSand
wolfSSL/CyaSSL7.47.0:mbedtls7.49.0:PolarSSLsha256support:7.44.0:
OpenSSL,GnuTLS,NSSandwolfSSL/CyaSSL.7.47.0:mbedtls7.49.0:PolarSSL
OtherSSLbackendsnotsupported.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
certstatus
(SSL)TellscurltoverifythestatusoftheservercertificatebyusingtheCertificate
StatusRequest([Link])TLSextension.
Ifthisoptionisenabledandtheserversendsaninvalid([Link])response,ifthe
responsesuggeststhattheservercertificatehasbeenrevoked,ornoresponseatall
isreceived,theverificationfails.
[Link] 12/51
28/04/2016 cURLHowToUse
ThisiscurrentlyonlyimplementedintheOpenSSL,GnuTLSandNSSbackends.
(Addedin7.41.0)
falsestart
(SSL)[Link]
whereaTLSclientwillstartsendingapplicationdatabeforeverifyingtheserver's
Finishedmessage,thussavingaroundtripwhenperformingafullhandshake.
ThisiscurrentlyonlyimplementedintheNSSandSecureTransport(oniOS7.0or
later,orOSX10.9orlater)backends.(Addedin7.42.0)
f,fail
(HTTP)Failsilently(nooutputatall)[Link]
[Link]
serverfailstodeliveradocument,itreturnsanHTMLdocumentstatingso(which
oftenalsodescribeswhyandmore).Thisflagwillpreventcurlfromoutputtingthat
andreturnerror22.
Thismethodisnotfailsafeandthereareoccasionswherenonsuccessfulresponse
codeswillslipthrough,especiallywhenauthenticationisinvolved(responsecodes
401and407).
F,form<name=content>
(HTTP)Thisletscurlemulateafilledinforminwhichauserhaspressedthesubmit
[Link]/formdata
[Link]
'content'parttobeafile,prefixthefilenamewithan@[Link]
partfromafile,prefixthefilenamewiththesymbol<.Thedifferencebetween@and
<isthenthat@makesafilegetattachedinthepostasafileupload,whilethe<
makesatextfieldandjustgetthecontentsforthattextfieldfromafile.
Example:tosendanimagetoaserver,where'profile'isthenameoftheformfieldto
[Link]:
curlFprofile=@[Link][Link]
Toreadcontentfromstdininsteadofafile,[Link]
@and<[Link]
pipeorsimilar,asitneedsthefullsizebeforethetransferstarts.
YoucanalsotellcurlwhatContentTypetousebyusing'type=',inamannersimilar
to:
curlF"web=@[Link]=text/html"[Link]
or
curlF"name=danieltype=text/foo"[Link]
Youcanalsoexplicitlychangethenamefieldofafileuploadpartbysetting
filename=,likethis:
curlF"file=@localfilefilename=nameinpost"[Link]
[Link] 13/51
28/04/2016 cURLHowToUse
Iffilename/pathcontains','or'',itmustbequotedbydoublequoteslike:
curlF"file=@\"localfile\"filename=\"nameinpost\""[Link]
or
curlF'file=@"localfile"filename="nameinpost"'[Link]
Notethatifafilename/pathisquotedbydoublequotes,anydoublequoteor
backslashwithinthefilenamemustbeescapedbybackslash.
SeefurtherexamplesanddetailsintheMANUAL.
Thisoptioncanbeusedmultipletimes.
ftpaccount[data]
(FTP)WhenanFTPserverasksfor"accountdata"afterusernameandpassword
hasbeenprovided,thisdataissentoffusingtheACCTcommand.(Addedin7.13.0)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
ftpalternativetouser<command>
(FTP)IfauthenticatingwiththeUSERandPASScommandsfails,sendthis
[Link]'sSecureTransportserveroverFTPS
usingaclientcertificate,using"SITEAUTH"willtelltheservertoretrievethe
usernamefromthecertificate.(Addedin7.15.5)
ftpcreatedirs
(FTP/SFTP)WhenanFTPorSFTPURL/operationusesapaththatdoesn'tcurrently
existontheserver,[Link],curlwill
insteadattempttocreatemissingdirectories.
ftpmethod[method]
(FTP)ControlwhatmethodcurlshouldusetoreachafileonanFTP(S)[Link]
methodargumentshouldbeoneofthefollowingalternatives:
multicwd
[Link]
hierarchiesthismeansverymanycommands.ThisishowRFC1738saysit
[Link].
nocwd
[Link],RETR,STORetcandgiveafullpath
[Link].
singlecwd
curldoesoneCWDwiththefulltargetdirectoryandthenoperatesonthefile
"normally"(likeinthemulticwdcase).Thisissomewhatmorestandards
compliantthan'nocwd'butwithoutthefullpenaltyof'multicwd'.
[Link] 14/51
28/04/2016 cURLHowToUse
(Addedin7.15.1)
ftppasv
(FTP)[Link]
behavior,butusingthisoptioncanbeusedtooverrideapreviousP/ftpportoption.
(Addedin7.11.0)
Ifthisoptionisusedseveraltimes,[Link]
passivereallyisn'tdoablebutyoumusttheninsteadenforcethecorrectP,ftpport
again.
PassivemodemeansthatcurlwilltrytheEPSVcommandfirstandthenPASV,
unlessdisableepsvisused.
ftpskippasvip
(FTP)TellcurltonotusetheIPaddresstheserversuggestsinitsresponsetocurl's
[Link]
sameIPaddressitalreadyusesforthecontrolconnection.(Addedin7.14.2)
ThisoptionhasnoeffectifPORT,EPRTorEPSVisusedinsteadofPASV.
ftppret
(FTP)TellcurltosendaPRETcommandbeforePASV(andEPSV).CertainFTP
servers,mainlydrftpd,requirethisnonstandardcommandfordirectorylistingsas
wellasupanddownloadsinPASVmode.(Addedin7.20.x)
ftpsslccc
(FTP)UseCCC(ClearCommandChannel)ShutsdowntheSSL/TLSlayerafter
[Link].
[Link].
Seeftpsslcccmodeforothermodes.(Addedin7.16.1)
ftpsslcccmode[active/passive]
(FTP)UseCCC(ClearCommandChannel)[Link]
willnotinitiatetheshutdown,butinsteadwaitfortheservertodoit,andwillnotreply
[Link]
areplyfromtheserver.(Addedin7.16.2)
ftpsslcontrol
(FTP)RequireSSL/TLSfortheFTPlogin,[Link]
authentication,[Link]
serverdoesn'tsupportSSL/TLS.(Addedin7.16.0)thatcanstillbeusedbutwillbe
removedinafutureversion.
ftpssl
(FTP)Thisdeprecatedoptionisnowknownasssl.
ftpsslreqd
[Link] 15/51
28/04/2016 cURLHowToUse
(FTP)Thisdeprecatedoptionisnowknownassslreqd.
formstring<name=string>
(HTTP)Similartoformexceptthatthevaluestringforthenamedparameterisused
[Link]'@'and'<'characters,andthe'type='stringinthevaluehaveno
[Link]'sanypossibilitythatthe
stringvaluemayaccidentallytriggerthe'@'or'<'featuresofform.
g,globoff
Thisoptionswitchesoffthe"URLglobbingparser".Whenyousetthisoption,youcan
specifyURLsthatcontaintheletters{}[]withouthavingthembeinginterpretedbycurl
[Link]
encodedaccordingtotheURIstandard.
G,get
Whenused,thisoptionwillmakealldataspecifiedwithd,data,databinaryor
dataurlencodetobeusedinanHTTPGETrequestinsteadofthePOSTrequestthat
[Link]'?'separator.
IfusedincombinationwithI,thePOSTdatawillinsteadbeappendedtotheURL
withaHEADrequest.
Ifthisoptionisusedseveraltimes,[Link]
aGETdoesn'tmakesense,butyoushouldtheninsteadenforcethealternative
methodyouprefer.
H,header<header>
(HTTP)[Link]
[Link]
headerthathasthesamenameasoneoftheinternalonescurlwoulduse,your
[Link]
[Link]
headerswithoutknowingperfectlywellwhatyou'[Link]
bygivingareplacementwithoutcontentontherightsideofthecolon,asin:H
"Host:".Ifyousendthecustomheaderwithnovaluethenitsheadermustbe
terminatedwithasemicolon,suchasH"XCustomHeader"tosend"XCustom
Header:".
curlwillmakesurethateachheaderyouadd/replaceissentwiththeproperendof
linemarker,youshouldthusnotaddthatasapartoftheheadercontent:donotadd
newlinesorcarriagereturns,theywillonlymessthingsupforyou.
SeealsotheA,useragentande,refereroptions.
Startingin7.37.0,youneedproxyheadertosendcustomheadersintendedfora
proxy.
Example:
#curlH"XFirstName:Joe"[Link]
WARNING:headerssetwiththisoptionwillbesetinallrequestsevenafter
[Link] 16/51
28/04/2016 cURLHowToUse
redirectsarefollowed,likewhentoldwithL,[Link]
beingsenttootherhoststhantheoriginalhost,sosensitiveheadersshouldbeused
withcautioncombinedwithfollowingredirects.
Thisoptioncanbeusedmultipletimestoadd/replace/removemultipleheaders.
hostpubmd5<md5>
(SCP/SFTP)[Link]
128bitMD5checksumoftheremotehost'spublickey,curlwillrefusetheconnection
withthehostunlessthemd5sumsmatch.(Addedin7.17.1)
ignorecontentlength
ForHTTP,[Link]
runningApache1.x,whichwillreportincorrectContentLengthforfileslargerthan2
gigabytes.
ForFTP(since7.46.0),skiptheRETRcommandtofigureoutthesizebefore
downloadingafile.
i,include
(HTTP)[Link]
servername,dateofthedocument,HTTPversionandmore...
I,head
(HTTP/FTP/FILE)FetchtheHTTPheaderonly!HTTPserversfeaturethecommand
[Link]
FTPorFILEfile,curldisplaysthefilesizeandlastmodificationtimeonly.
interface<name>
[Link],IP
[Link]:
curlinterfaceeth0:1[Link]
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
j,junksessioncookies
(HTTP)Whencurlistoldtoreadcookiesfromagivenfile,thisoptionwillmakeit
discardall"sessioncookies".Thiswillbasicallyhavethesameeffectasifanew
[Link]'re
closeddown.
J,remoteheadername
(HTTP)ThisoptiontellstheO,remotenameoptiontousetheserverspecified
ContentDispositionfilenameinsteadofextractingafilenamefromtheURL.
Iftheserverspecifiesafilenameandafilewiththatnamealreadyexistsinthe
[Link]
doesn'tspecifyafilenamethenthisoptionhasnoeffect.
[Link] 17/51
28/04/2016 cURLHowToUse
There'snoattempttodecode%sequences(yet)intheprovidedfilename,sothis
optionmayprovideyouwithratherunexpectedfilenames.
WARNING:Exercisejudicioususeofthisoption,[Link]
servercouldsendyouthenameofaDLLorotherfilethatcouldpossiblybeloaded
automaticallybyWindowsorsomethirdpartysoftware.
k,insecure
(SSL)Thisoptionexplicitlyallowscurltoperform"insecure"SSLconnectionsand
[Link]
[Link]
"insecure"failunlessk,insecureisused.
Seethisonlineresourceforfurtherdetails:[Link]
K,config<configfile>
[Link]
whichcommandlineargumentscanbewrittenwhichthenwillbeusedasiftheywere
writtenontheactualcommandline.
Optionsandtheirparametersmustbespecifiedonthesameconfigfileline,
separatedbywhitespace,colon,[Link]
begivenintheconfigfilewithouttheinitialdoubledashesandifso,thecolonor
[Link]
dashes,therecanbenocolonorequalscharacterbetweentheoptionandits
parameter.
Iftheparameteristocontainwhitespace,theparametermustbeenclosedwithin
[Link],thefollowingescapesequencesareavailable:\\,\",\t,
\n,\rand\[Link]
configlineisa'#'character,[Link]
writeoneoptionperphysicallineintheconfigfile.
SpecifythefilenametoK,configas''tomakecurlreadthefilefromstdin.
NotethattobeabletospecifyaURLintheconfigfile,youneedtospecifyitusingthe
urloption,[Link],itcouldlooksimilar
tothis:
url="[Link]
Whencurlisinvoked,italways(unlessqisused)checksforadefaultconfigfileand
[Link]
order:
1)curltriestofindthe"homedir":ItfirstchecksfortheCURL_HOMEandthenthe
[Link],itusesgetpwuid()onUnixlikesystems
(whichreturnsthehomedirgiventhecurrentuserinyoursystem).OnWindows,it
thenchecksfortheAPPDATAvariable,orasalastresortthe
'%USERPROFILE%\ApplicationData'.
2)Onwindows,ifthereisno_curlrcfileinthehomedir,itchecksforoneinthesame
[Link],[Link]
fromthedeterminedhomedir.
[Link] 18/51
28/04/2016 cURLHowToUse
#Examplefile
#thisisacomment
url="[Link]"
output="[Link]"
useragent="superagent/1.0"
#andfetchanotherURLtoo
url="[Link]/docs/[Link]"
O
referer="[Link]
#Endofexamplefile
Thisoptioncanbeusedmultipletimestoloadmultipleconfigfiles.
keepalivetime<seconds>
Thisoptionsetsthetimeaconnectionneedstoremainidlebeforesendingkeepalive
[Link]
operatingsystemsofferingtheTCP_KEEPIDLEandTCP_KEEPINTVLsocket
options(meaningLinux,recentAIX,HPUXandmore).Thisoptionhasnoeffectif
nokeepaliveisused.(Addedin7.18.0)
Ifthisoptionisusedseveraltimes,[Link],theoption
defaultsto60seconds.
key<key>
(SSL/SSH)[Link]
[Link],ifnotspecified,curltriesthefollowingcandidatesinorder:
'~/.ssh/id_rsa','~/.ssh/id_dsa','./id_rsa','./id_dsa'.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
keytype<type>
(SSL)[Link].
DER,PEM,[Link],PEMisassumed.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
krb<level>
(FTP)[Link]
beoneof'clear','safe','confidential',or'private'.Shouldyouusealevelthatisnot
oneofthese,'private'willinsteadbeused.
[Link].
UseV,versiontoseeifyourcurlsupportsit.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
krb4<level>
(FTP)[Link].
l,listonly
[Link] 19/51
28/04/2016 cURLHowToUse
(FTP)WhenlistinganFTPdirectory,[Link]
especiallyusefuliftheuserwantstomachineparsethecontentsofanFTPdirectory
sincethenormaldirectoryviewdoesn'[Link]
this,theoptioncausesaNLSTcommandtobesenttotheserverinsteadofLIST.
Note:SomeFTPserverslistonlyfilesintheirresponsetoNLSTtheydonotinclude
subdirectoriesandsymboliclinks.
(POP3)WhenretrievingaspecificemailfromPOP3,thisswitchforcesaLIST
[Link]
wantstoseeifaspecificmessageidexistsontheserverandwhatsizeitis.
Note:WhencombinedwithX,request<command>,thisoptioncanbeusedtosend
anUIDLcommandinstead,sotheusermayusetheemail'suniqueidentifierrather
thanit'smessageidtomaketherequest.(Addedin7.21.5)
L,location
(HTTP/HTTPS)Iftheserverreportsthattherequestedpagehasmovedtoadifferent
location(indicatedwithaLocation:headeranda3XXresponsecode),thisoptionwill
[Link],includeorI,
head,[Link],
[Link]
host,itwon'tbeabletointercepttheuser+[Link]
[Link]
redirsoption.
WhencurlfollowsaredirectandtherequestisnotaplainGET(forexamplePOSTor
PUT),itwilldothefollowingrequestwithaGETiftheHTTPresponsewas301,302,
or303.Iftheresponsecodewasanyother3xxcode,curlwillresendthefollowing
requestusingthesameunmodifiedmethod.
YoucantellcurltonotchangethenonGETrequestmethodtoGETaftera30x
responsebyusingthededicatedoptionsforthat:post301,post302andpost303.
libcurl<file>
Appendthisoptiontoanyordinarycurlcommandline,andyouwillgetalibcurlusing
Csourcecodewrittentothefilethatdoestheequivalentofwhatyourcommandline
operationdoes!
Ifthisoptionisusedseveraltimes,thelastgivenfilenamewillbeused.(Addedin
7.16.1)
limitrate<speed>
Specifythemaximumtransferrateyouwantcurltouseforbothdownloadsand
[Link]'dlikeyourtransfer
[Link].
Thegivenspeedismeasuredinbytes/second,unlessasuffixisappended.
Appending'k'or'K'willcountthenumberaskilobytes,'m'orM'makesitmegabytes,
while'g'or'G'[Link]:200K,3mand1G.
[Link]
curlmightusehighertransferspeedsinshortbursts,butovertimeitusesnomore
[Link] 20/51
28/04/2016 cURLHowToUse
thanthegivenrate.
IfyoualsousetheY,speedlimitoption,thatoptionwilltakeprecedenceandmight
crippletheratelimitingslightly,tohelpkeepingthespeedlimitlogicworking.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
localport<num>[num]
Setapreferrednumberorrangeoflocalportnumberstousefortheconnection(s).
Notethatportnumbersbynatureareascarceresourcethatwillbebusyattimesso
settingthisrangetosomethingtoonarrowmightcauseunnecessaryconnection
setupfailures.(Addedin7.15.2)
locationtrusted
(HTTP/HTTPS)LikeL,location,butwillallowsendingthename+passwordtoall
[Link]
thesiteredirectsyoutoasitetowhichyou'llsendyourauthenticationinfo(whichis
plaintextinthecaseofHTTPBasicauthentication).
m,maxtime<seconds>
[Link]
forpreventingyourbatchjobsfromhangingforhoursduetoslownetworksorlinks
goingdown.Since7.32.0,thisoptionacceptsdecimalvalues,buttheactualtimeout
[Link]
alsotheconnecttimeoutoption.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
loginoptions<options>
Specifytheloginoptionstouseduringserverauthentication.
Youcanusetheloginoptionstospecifyprotocolspecificoptionsthatmaybeused
[Link],POP3andSMTPsupportloginoptions.
FormoreinformationabouttheloginoptionspleaseseeRFC2384,RFC5092and
[Link](Addedin7.34.0).
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
mailauth<address>
(SMTP)[Link]
address(identity)ofasubmittedmessagethatisbeingrelayedtoanotherserver.
(Addedin7.25.0)
mailfrom<address>
(SMTP)Specifyasingleaddressthatthegivenmailshouldgetsentfrom.
(Addedin7.20.0)
maxfilesize<bytes>
[Link] 21/51
28/04/2016 cURLHowToUse
Specifythemaximumsize(inbytes)[Link]
largerthanthisvalue,thetransferwillnotstartandcurlwillreturnwithexitcode63.
NOTE:Thefilesizeisnotalwaysknownpriortodownload,andforsuchfilesthis
optionhasnoeffectevenifthefiletransferendsupbeinglargerthanthisgivenlimit.
ThisconcernsbothFTPandHTTPtransfers.
mailrcpt<address>
(SMTP)Specifyasingleaddress,usernameormailinglistname.
Whenperformingamailtransfer,therecipientshouldspecifyavalidemailaddressto
sendthemailto.(Addedin7.20.0)
Whenperforminganaddressverification(VRFYcommand),therecipientshouldbe
specifiedastheusernameorusernameanddomain(asperSection3.5ofRFC
5321).(Addedin7.34.0)
Whenperformingamailinglistexpand(EXPNcommand),therecipientshouldbe
specifiedusingthemailinglistname,suchas"Friends"or"LondonOffice".(Addedin
7.34.0)
maxredirs<num>
[Link],locationisused,this
optioncanbeusedtopreventcurlfromfollowingredirections"inabsurdum".By
default,thelimitissetto50redirections.Setthisoptionto1tomakeitlimitless.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
metalink
ThisoptioncantellcurltoparseandprocessagivenURIasMetalinkfile(both
version3and4(RFC5854)aresupported)andmakeuseofthemirrorslistedwithin
forfailoverifthereareerrors(suchasthefileorservernotbeingavailable).Itwillalso
[Link]
downloadedandprocessedinmemoryandnotstoredinthelocalfilesystem.
ExampletousearemoteMetalinkfile:
curlmetalink[Link]
TouseaMetalinkfileinthelocalfilesystem,useFILEprotocol([Link]
curlmetalink[Link]
PleasenotethatifFILEprotocolisdisabled,thereisnowaytousealocalMetalink
[Link]
together,[Link]
willbreakMetalinkparserandiftheheadersareincludedinthefiledescribedin
Metalinkfile,hashcheckwillfail.
(Addedin7.27.0,ifbuiltagainstthelibmetalinklibrary.)
n,netrc
[Link] 22/51
28/04/2016 cURLHowToUse
[Link](_netrconWindows)fileintheuser'shomedirectoryfor
[Link],
[Link](5)ftp(1)fordetailsonthefileformat.
Curlwillnotcomplainifthatfiledoesn'thavetherightpermissions(itshouldnotbe
eitherworldorgroupreadable).Theenvironmentvariable"HOME"isusedtofindthe
homedirectory.
[Link]
[Link]'myself'andpassword'secret'shouldlook
similarto:
[Link]
N,nobuffer
[Link],curlwillusea
standardbufferedoutputstreamthatwillhavetheeffectthatitwilloutputthedatain
chunks,[Link]
thatbuffering.
[Link]
enforcethebuffering.
netrcfile
Thisoptionissimilartonetrc,exceptthatyouprovidethepath(absoluteorrelative)
[Link]
[Link],onlythelastonewillbeused.
(Addedin7.21.5)
[Link]
abidebynetrcoptionalifspecified.
netrcoptional
Verysimilartonetrc,[Link]
mandatoryasthenetrcoptiondoes.
negotiate
(HTTP)EnablesNegotiate(SPNEGO)authentication.
IfyouwanttoenableNegotiate(SPNEGO)forproxyauthentication,thenuseproxy
negotiate.
[Link],versionto
seeifyourcurlsupportsGSSAPI/SSPIandSPNEGO.
Whenusingthisoption,youmustalsoprovideafakeu,useroptiontoactivatethe
[Link]'u:'isenoughastheusernameand
passwordfromtheuoptionaren'tactuallyused.
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.
nokeepalive
[Link] 23/51
28/04/2016 cURLHowToUse
DisablestheuseofkeepalivemessagesontheTCPconnection,asbydefaultcurl
enablesthem.
[Link]
toenforcekeepalive.
nosessionid
(SSL)Disablecurl'[Link]
[Link]
SSLsessionIDs,thereseemtobebrokenSSLimplementationsinthewildthatmay
requireyoutodisablethisinorderforyoutosucceed.(Addedin7.16.0)
[Link]
toenforcesessionIDcaching.
noproxy<noproxylist>
Commaseparatedlistofhostswhichdonotuseaproxy,[Link]
wildcardisasingle*character,whichmatchesallhosts,andeffectivelydisablesthe
[Link]
hostname,[Link],[Link],
[Link],[Link],[Link].(Addedin7.19.4).
connectto<host:port:connecttohost:connecttoport>
Forarequesttothegiven"host:port"pair,connectto"connecttohost:connectto
port"[Link],[Link]
[Link]
[Link]/portthatisusedforTLS/SSL
([Link],certificateverification)orfortheapplicationprotocols."host"and"port"may
betheemptystring,meaning"anyhost/port"."connecttohost"and"connecttoport"
mayalsobetheemptystring,meaning"usetherequest'soriginalhost/port".This
optioncanbeusedmanytimestoaddmanyconnectrules.(Addedin7.49.0).
ntlm
(HTTP)[Link]
[Link],
reverseengineeredbycleverpeopleandimplementedincurlbasedontheirefforts.
Thiskindofbehaviorshouldnotbeendorsed,youshouldencourageeveryonewho
usesNTLMtoswitchtoapublicanddocumentedauthenticationmethodinstead,
suchasDigest.
IfyouwanttoenableNTLMforyourproxyauthentication,thenuseproxyntlm.
[Link],versiontoseeifyour
curlsupportsNTLM.
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.
ntlmwb
(HTTP)EnablesNTLMmuchinthestylentlmdoes,buthandoverthe
authenticationtotheseparatebinaryntlmauthapplicationthatisexecutedwhen
needed.
[Link] 24/51
28/04/2016 cURLHowToUse
o,output<file>
Writeoutputto<file>[Link]{}or[]tofetchmultiple
documents,youcanuse'#'followedbyanumberinthe<file>[Link]
[Link]:
curl[Link]
oruseseveralvariableslike:
curl[Link]
YoumayusethisoptionasmanytimesasthenumberofURLsyouhave.
[Link]
theoutputas''(asingledash)willforcetheoutputtobedonetostdout.
O,remotename
Writeoutputtoalocalfilenamedliketheremotefileweget.(Onlythefilepartofthe
remotefileisused,thepathiscutoff.)
[Link]
differentdirectory,makesureyouchangethecurrentworkingdirectorybefore
invokingcurlwiththisoption.
TheremotefilenametouseforsavingisextractedfromthegivenURL,nothingelse,
[Link]
thefilenamerefertoJ,remoteheadernamewhichcanbeusedinadditiontothis
[Link]
overwritten.
[Link]%20orotherURLencoded
partsofthename,theywillendupasisasfilename.
YoumayusethisoptionasmanytimesasthenumberofURLsyouhave.
oauth2bearer
(IMAP,POP3,SMTP)SpecifytheBearerTokenforOAUTH2.0serverauthentication.
TheBearerTokenisusedinconjunctionwiththeusernamewhichcanbespecified
aspartoftheurloru,useroptions.
TheBearerTokenandusernameareformattedaccordingtoRFC6750.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
proxyheader<header>
(HTTP)[Link]
[Link],
headerbutisforproxycommunicationonlylikeinCONNECTrequestswhenyou
wantaseparateheadersenttotheproxytowhatissenttotheactualremotehost.
curlwillmakesurethateachheaderyouadd/replaceissentwiththeproperendof
linemarker,youshouldthusnotaddthatasapartoftheheadercontent:donotadd
[Link] 25/51
28/04/2016 cURLHowToUse
newlinesorcarriagereturns,theywillonlymessthingsupforyou.
Headersspecifiedwiththisoptionwillnotbeincludedinrequeststhatcurlknowswill
notbesenttoaproxy.
Thisoptioncanbeusedmultipletimestoadd/replace/removemultipleheaders.
(Addedin7.37.0)
p,proxytunnel
WhenanHTTPproxyisused(x,proxy),thisoptionwillcausenonHTTPprotocols
toattempttotunnelthroughtheproxyinsteadofmerelyusingittodoHTTPlike
[Link]
andrequiresthattheproxyallowsdirectconnecttotheremoteportnumbercurl
wantstotunnelthroughto.
P,ftpport<address>
(FTP)Reversesthedefaultinitiator/[Link]
[Link],curlthentellstheservertoconnect
backtotheclient'sspecifiedaddressandport,whilepassivemodeaskstheserverto
setupanIPaddressandportforittoconnectto.<address>shouldbeoneof:
interface
i.e"eth0"tospecifywhichinterface'sIPaddressyouwanttouse(Unixonly)
IPaddress
i.e"[Link]"tospecifytheexactIPaddress
hostname
i.e"[Link]"tospecifythemachine
makecurlpickthesameIPaddressthatisalreadyusedforthecontrol
connection
Ifthisoptionisusedseveraltimes,[Link]
[Link]
[Link]++.
Startingin7.19.5,youcanappend":[start][end]"totherightoftheaddress,totellcurl
[Link],fromalowertoa
[Link],butdonotethatitincreasestheriskof
failuresincetheportmaynotbeavailable.
pass<phrase>
(SSL/SSH)Passphrasefortheprivatekey
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
[Link] 26/51
28/04/2016 cURLHowToUse
pathasis
Tellcurltonothandlesequencesof/../or/./[Link]
squashormergethemaccordingtostandardsbutwiththisoptionsetyoutellitnotto
dothat.
(Addedin7.42.0)
post301
(HTTP)TellscurltorespectRFC7230/6.4.2andnotconvertPOSTrequestsinto
[Link]
inwebbrowsers,socurldoestheconversionbydefaulttomaintainconsistency.
However,aservermayrequireaPOSTtoremainaPOSTaftersucharedirection.
ThisoptionismeaningfulonlywhenusingL,location(Addedin7.17.1)
post302
(HTTP)TellscurltorespectRFC7230/6.4.3andnotconvertPOSTrequestsinto
[Link]
inwebbrowsers,socurldoestheconversionbydefaulttomaintainconsistency.
However,aservermayrequireaPOSTtoremainaPOSTaftersucharedirection.
ThisoptionismeaningfulonlywhenusingL,location(Addedin7.19.1)
post303
(HTTP)TellscurltorespectRFC7230/6.4.4andnotconvertPOSTrequestsinto
[Link]
inwebbrowsers,socurldoestheconversionbydefaulttomaintainconsistency.
However,aservermayrequireaPOSTtoremainaPOSTaftersucharedirection.
ThisoptionismeaningfulonlywhenusingL,location(Addedin7.26.0)
proto<protocols>
[Link]
toright,arecommaseparated,andareeachaprotocolnameor'all',optionally
[Link]:
+Permitthisprotocolinadditiontoprotocolsalreadypermitted(thisisthedefault
ifnomodifierisused).
Denythisprotocol,removingitfromthelistofprotocolsalreadypermitted.
=Permitonlythisprotocol(ignoringthelistalreadypermitted),thoughsubjectto
latermodificationbysubsequententriesinthecommaseparatedlist.
Forexample:
protoftpsusesthedefaultprotocols,butdisablesftps
protoall,https,+httponlyenableshttpandhttps
proto=http,httpsalsoonlyenableshttpandhttps
[Link]
todisablepotentiallydangerousprotocols,withoutrelyinguponsupportforthat
[Link] 27/51
28/04/2016 cURLHowToUse
protocolbeingbuiltintocurltoavoidanerror.
Thisoptioncanbeusedmultipletimes,inwhichcasetheeffectisthesameas
concatenatingtheprotocolsintooneinstanceoftheoption.
(Addedin7.20.2)
protodefault<protocol>
TellscurltouseprotocolforanyURLmissingaschemename.
Example:
[Link]
[Link]
Anunknownorunsupportedprotocolcauseserror
CURLE_UNSUPPORTED_PROTOCOL.
Thisoptiondoesnotchangethedefaultproxyprotocol(http).
Withoutthisoptioncurlwouldmakeaguessbasedonthehost,seeurlfordetails.
(Addedin7.45.0)
protoredir<protocols>
[Link]
represented.
Example:
protoredirall,http,https
AllowonlyHTTPandHTTPSonredirect.
Bydefaultcurlwillallowallprotocolsonredirectexceptseveraldisabledforsecurity
reasons:Since7.19.4FILEandSCParedisabled,andsince7.40.0SMBandSMBS
[Link]+allenablesallprotocolsonredirect,including
thosedisabledforsecurity.
(Addedin7.20.2)
proxyanyauth
Tellscurltopickasuitableauthenticationmethodwhencommunicatingwiththegiven
[Link]/responseroundtrip.(Addedin7.13.2)
proxybasic
TellscurltouseHTTPBasicauthenticationwhencommunicatingwiththegiven
[Link]
authenticationmethodcurluseswithproxies.
proxydigest
[Link] 28/51
28/04/2016 cURLHowToUse
TellscurltouseHTTPDigestauthenticationwhencommunicatingwiththegiven
[Link].
proxynegotiate
TellscurltouseHTTPNegotiate(SPNEGO)authenticationwhencommunicatingwith
[Link](SPNEGO)witha
remotehost.(Addedin7.17.1)
proxyntlm
TellscurltouseHTTPNTLMauthenticationwhencommunicatingwiththegiven
[Link].
proxyservicename<servicename>
Thisoptionallowsyoutochangetheservicenameforproxynegotiation.
Examples:proxynegotiateproxynameproxyservicenamesockdwoulduse
sockd/proxyname.(Addedin7.43.0).
proxy1.0<proxyhost[:port]>
[Link],itisassumedat
port1080.
TheonlydifferencebetweenthisandtheHTTPproxyoption(x,proxy),isthat
attemptstouseCONNECTthroughtheproxywillspecifyanHTTP1.0protocol
insteadofthedefaultHTTP1.1.
pubkey<key>
(SSH)[Link].
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
(Asof7.39.0,curlattemptstoautomaticallyextractthepublickeyfromtheprivatekey
file,[Link]
extractionrequireslibcurltobelinkedagainstacopyoflibssh21.2.8orhigherthatis
itselflinkedagainstOpenSSL.)
q,disable
Ifusedasthefirstparameteronthecommandline,thecurlrcconfigfilewillnotbe
[Link],configfordetailsonthedefaultconfigfilesearchpath.
Q,quote<command>
(FTP/SFTP)[Link]
commandsaresentBEFOREthetransfertakesplace(justaftertheinitialPWD
commandinanFTPtransfer,tobeexact).Tomakecommandstakeplaceaftera
successfultransfer,prefixthemwithadash''.Tomakecommandsbesentaftercurl
haschangedtheworkingdirectory,justbeforethetransfercommand(s),prefixthe
commandwitha'+'(thisisonlysupportedforFTP).Youmayspecifyanynumberof
[Link],theentireoperation
willbeaborted.YoumustsendsyntacticallycorrectFTPcommandsasRFC959
[Link] 29/51
28/04/2016 cURLHowToUse
definestoFTPservers,[Link]
[Link],prefixthe
commandwithanasterisk(*)tomakecurlcontinueevenifthecommandfailsasby
defaultcurlwillstopatfirstfailure.
[Link],curlinterpretsSFTPquotecommandsitself
[Link]
[Link]
commands:
chgrpgroupfile
ThechgrpcommandsetsthegroupIDofthefilenamedbythefileoperandtothe
[Link]
groupID.
chmodmodefile
[Link]
operandisanoctalintegermodenumber.
chownuserfile
Thechowncommandsetstheownerofthefilenamedbythefileoperandtothe
[Link]
userID.
lnsource_filetarget_file
Thelnandsymlinkcommandscreateasymboliclinkatthetarget_filelocation
pointingtothesource_filelocation.
mkdirdirectory_name
Themkdircommandcreatesthedirectorynamedbythedirectory_name
operand.
pwd
Thepwdcommandreturnstheabsolutepathnameofthecurrentworking
directory.
renamesourcetarget
Therenamecommandrenamesthefileordirectorynamedbythesource
operandtothedestinationpathnamedbythetargetoperand.
rmfile
Thermcommandremovesthefilespecifiedbythefileoperand.
rmdirdirectory
Thermdircommandremovesthedirectoryentryspecifiedbythedirectory
operand,provideditisempty.
[Link] 30/51
28/04/2016 cURLHowToUse
symlinksource_filetarget_file
Seeln.
r,range<range>
(HTTP/FTP/SFTP/FILE)Retrieveabyterange([Link])froma
HTTP/1.1,[Link]
ofways.
0499specifiesthefirst500bytes
500999specifiesthesecond500bytes
500specifiesthelast500bytes
9500specifiesthebytesfromoffset9500andforward
00,1specifiesthefirstandlastbyteonly(*)(HTTP)
100199,500599specifiestwoseparate100byteranges(*)(HTTP)
(*)=NOTEthatthiswillcausetheservertoreplywithamultipartresponse!
Onlydigitcharacters(09)arevalidinthe'start'and'stop'fieldsofthe'startstop'
[Link],theserver'sresponsewill
beunspecified,dependingontheserver'sconfiguration.
YoushouldalsobeawarethatmanyHTTP/1.1serversdonothavethisfeature
enabled,sothatwhenyouattempttogetarange,you'llinsteadgetthewhole
document.
FTPandSFTPrangedownloadsonlysupportthesimple'startstop'syntax(optionally
withoneofthenumbersomitted).FTPusedependsontheextendedFTPcommand
SIZE.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
R,remotetime
Whenused,thiswillmakecurlattempttofigureoutthetimestampoftheremotefile,
andifthatisavailablemakethelocalfilegetthatsametimestamp.
randomfile<file>
(SSL)Specifythepathnametofilecontainingwhatwillbeconsideredasrandom
[Link]
egdfileoption.
raw
(HTTP)Whenused,itdisablesallinternalHTTPdecodingofcontentortransfer
encodingsandinsteadmakesthempassedonunaltered,raw.(Addedin7.16.2)
remotenameall
[Link] 31/51
28/04/2016 cURLHowToUse
ThisoptionchangesthedefaultactionforallgivenURLstobedealtwithasifO,
[Link]
URLafterremotenameallhasbeenused,youmustuse"o"ornoremote
name.(Addedin7.19.0)
resolve<host:port:address>
[Link],youcanmake
thecurlrequests(s)useaspecifiedaddressandpreventtheotherwisenormally
[Link]/etc/hostsalternativeprovidedon
[Link]
[Link]
provideaddressforthesamehostbutdifferentports.
Thisoptioncanbeusedmanytimestoaddmanyhostnamestoresolve.
(Addedin7.21.3)
retry<num>
Ifatransienterrorisreturnedwhencurltriestoperformatransfer,itwillretrythis
numberoftimesbeforegivingup.Settingthenumberto0makescurldonoretries
(whichisthedefault).Transienterrormeanseither:atimeout,anFTP4xxresponse
codeoranHTTP5xxresponsecode.
Whencurlisabouttoretryatransfer,itwillfirstwaitonesecondandthenforall
forthcomingretriesitwilldoublethewaitingtimeuntilitreaches10minuteswhich
[Link]
[Link]
timeallowedforretries.(Addedin7.12.3)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
retrydelay<seconds>
Makecurlsleepthisamountoftimebeforeeachretrywhenatransferhasfailedwith
atransienterror(itchangesthedefaultbackofftimealgorithmbetweenretries).This
[Link]
usethedefaultbackofftime.(Addedin7.12.3)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
retrymaxtime<seconds>
[Link]
(seeretry)aslongasthetimerhasn'[Link]
hasn'treachedthelimit,therequestwillbemadeandwhileperforming,itmaytake
[Link],usem,
[Link].(Addedin7.12.3)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
s,silent
[Link]'[Link]
[Link],potentiallyeventotheterminal/stdout
[Link] 32/51
28/04/2016 cURLHowToUse
unlessyouredirectit.
saslir
EnableinitialresponseinSASLauthentication.(Addedin7.31.0)
servicename<servicename>
ThisoptionallowsyoutochangetheservicenameforSPNEGO.
Examples:negotiateservicenamesockdwouldusesockd/servername.(Addedin
7.43.0).
S,showerror
Whenusedwithsitmakescurlshowanerrormessageifitfails.
ssl
(FTP,POP3,IMAP,SMTP)TrytouseSSL/[Link]
secureconnectioniftheserverdoesn'tsupportSSL/[Link]
andsslreqdfordifferentlevelsofencryptionrequired.(Addedin7.20.0)
Thisoptionwasformerlyknownasftpssl(Addedin7.11.0).Thatoptionnamecan
stillbeusedbutwillberemovedinafutureversion.
sslreqd
(FTP,POP3,IMAP,SMTP)RequireSSL/[Link]
connectioniftheserverdoesn'tsupportSSL/TLS.(Addedin7.20.0)
Thisoptionwasformerlyknownasftpsslreqd.
sslallowbeast
(SSL)ThisoptiontellscurltonotworkaroundasecurityflawintheSSL3andTLS1.0
[Link]'tused,theSSLlayermayuse
workaroundsknowntocauseinteroperabilityproblemswithsomeolderSSL
[Link]:thisoptionloosenstheSSLsecurity,andbyusingthis
flagyouaskforexactlythat.(Addedin7.25.0)
sslnorevoke
(WinSSL)[Link]:
thisoptionloosenstheSSLsecurity,andbyusingthisflagyouaskforexactlythat.
(Addedin7.44.0)
socks4<host[:port]>
[Link],itisassumedat
port1080.(Addedin7.15.2)
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks4proxywithx,
proxyusingasocks4://protocolprefix.
[Link] 33/51
28/04/2016 cURLHowToUse
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
socks4a<host[:port]>
[Link],itisassumed
atport1080.(Addedin7.18.0)
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks4aproxywithx,
proxyusingasocks4a://protocolprefix.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
socks5hostname<host[:port]>
UsethespecifiedSOCKS5proxy(andlettheproxyresolvethehostname).Iftheport
numberisnotspecified,itisassumedatport1080.(Addedin7.18.0)
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks5hostname
proxywithx,proxyusingasocks5h://protocolprefix.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.(Thisoptionwas
previouslywronglydocumentedandusedassockswithoutthenumberappended.)
socks5<host[:port]>
[Link]
numberisnotspecified,itisassumedatport1080.
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks5proxywithx,
proxyusingasocks5://protocolprefix.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.(Thisoptionwas
previouslywronglydocumentedandusedassockswithoutthenumberappended.)
Thisoption(aswellassocks4)doesnotworkwithIPV6,FTPSorLDAP.
socks5gssapiservice<servicename>
Thedefaultservicenameforasocksserverisrcmd/[Link]
youtochangeit.
Examples:socks5proxynamesocks5gssapiservicesockdwoulduse
sockd/proxynamesocks5proxynamesocks5gssapiservicesockd/realname
wouldusesockd/realnameforcaseswheretheproxynamedoesnotmatchthe
principalname.(Addedin7.19.4).
socks5gssapinec
AspartoftheGSSAPInegotiationaprotectionmodeisnegotiated.RFC1961says
insection4.3/4.4itshouldbeprotected,buttheNECreferenceimplementationdoes
[Link] 34/51
28/04/2016 cURLHowToUse
not.Theoptionsocks5gssapinecallowstheunprotectedexchangeofthe
protectionmodenegotiation.(Addedin7.19.4).
stderr<file>
[Link]'',it
isinsteadwrittentostdout.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
t,telnetoption<OPT=val>
[Link]:
TTYPE=<term>Setstheterminaltype.
XDISPLOC=<Xdisplay>SetstheXdisplaylocation.
NEW_ENV=<var,val>Setsanenvironmentvariable.
T,uploadfile<file>
[Link]
specifiedURL,[Link]
/onthelastdirectorytoreallyprovetoCurlthatthereisnofilenameorcurlwillthink
[Link]
[Link](S)server,thePUT
commandwillbeused.
Usethefilename""(asingledash)[Link],
thefilename"."(asingleperiod)maybespecifiedinsteadof""tousestdininnon
blockingmodetoallowreadingserveroutputwhilestdinisbeinguploaded.
[Link]+URLpair
[Link]"globbing"oftheT
argument,meaningthatyoucanuploadmultiplefilestoasingleURLbyusingthe
sameURLglobbingstylesupportedintheURL,likethis:
curlT"{file1,file2}"[Link]
oreven
curlT"img[11000].png"[Link]
tcpnodelay
TurnontheTCP_NODELAYoption.Seethecurl_easy_setopt(3)manpagefor
detailsaboutthisoption.(Addedin7.11.2)
tcpfastopen
EnableuseofTCPFastOpen(RFC7413).(Addedin7.49.0)
tftpblksize<value>
(TFTP)SetTFTPBLKSIZEoption(mustbe>512).Thisistheblocksizethatcurlwill
[Link] 35/51
28/04/2016 cURLHowToUse
trytousewhentransferringdatatoorfromaTFTPserver.Bydefault512byteswill
beused.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
(Addedin7.20.0)
tftpnooptions
(TFTP)TellscurlnottosendTFTPoptionsrequests.
Thisoptionimprovesinteropwithsomelegacyserversthatdonotacknowledgeor
[Link].
(Addedin7.48.0)
tlsauthtype<authtype>
[Link],theonlysupportedoptionis"SRP",forTLS
SRP(RFC5054).Iftlsuserandtlspasswordarespecifiedbuttlsauthtypeisnot,
thenthisoptiondefaultsto"SRP".(Addedin7.21.4)
tlspassword<password>
SetpasswordforusewiththeTLSauthenticationmethodspecifiedwithtlsauthtype.
Requiresthattlsuseralsobeset.(Addedin7.21.4)
tlsuser<user>
SetusernameforusewiththeTLSauthenticationmethodspecifiedwithtlsauthtype.
Requiresthattlspasswordalsobeset.(Addedin7.21.4)
tlsv1.0
(SSL)ForcescurltouseTLSversion1.0whennegotiatingwitharemoteTLSserver.
(Addedin7.34.0)
tlsv1.1
(SSL)ForcescurltouseTLSversion1.1whennegotiatingwitharemoteTLSserver.
(Addedin7.34.0)
tlsv1.2
(SSL)ForcescurltouseTLSversion1.2whennegotiatingwitharemoteTLSserver.
(Addedin7.34.0)
trencoding
(HTTP)RequestacompressedTransferEncodingresponseusingoneofthe
algorithmscurlsupports,anduncompressthedatawhilereceivingit.
(Addedin7.21.6)
trace<file>
Enablesafulltracedumpofallincomingandoutgoingdata,includingdescriptive
[Link] 36/51
28/04/2016 cURLHowToUse
information,[Link]""asfilenametohavetheoutputsentto
stdout.
Thisoptionoverridesprevioususesofv,verboseortraceascii.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
traceascii<file>
Enablesafulltracedumpofallincomingandoutgoingdata,includingdescriptive
information,[Link]""asfilenametohavetheoutputsentto
stdout.
Thisisverysimilartotrace,butleavesoutthehexpartandonlyshowstheASCII
[Link]
humans.
Thisoptionoverridesprevioususesofv,verboseortrace.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
tracetime
Prependsatimestamptoeachtraceorverboselinethatcurldisplays.(Addedin
7.14.0)
unixsocket<path>
(HTTP)ConnectthroughthisUnixdomainsocket,insteadofusingthenetwork.
(Addedin7.40.0)
u,user<user:password>
[Link],
netrcandnetrcoptional.
Ifyousimplyspecifytheusername,curlwillpromptforapassword.
Theusernameandpasswordsaresplituponthefirstcolon,whichmakesit
[Link],still.
WhenusingKerberosV5withaWindowsbasedserveryoushouldincludethe
Windowsdomainnameintheusername,inorderfortheservertosuccessfullyobtain
[Link]'tthentheinitialauthenticationhandshakemayfail.
WhenusingNTLM,theusernamecanbespecifiedsimplyastheusername,without
thedomain,ifthereisasingledomainandforestinyoursetupforexample.
TospecifythedomainnameuseeitherDownLevelLogonNameorUPN(User
PrincipalName)[Link],EXAMPLE\useranduser@[Link]
respectively.
IfyouuseaWindowsSSPIenabledcurlbinaryandperformKerberosV5,Negotiate,
NTLMorDigestauthenticationthenyoucantellcurltoselecttheusernameand
passwordfromyourenvironmentbyspecifyingasinglecolonwiththisoption:"u:".
[Link] 37/51
28/04/2016 cURLHowToUse
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
U,proxyuser<user:password>
Specifytheusernameandpasswordtouseforproxyauthentication.
IfyouuseaWindowsSSPIenabledcurlbinaryanddoeitherNegotiateorNTLM
authenticationthenyoucantellcurltoselecttheusernameandpasswordfromyour
environmentbyspecifyingasinglecolonwiththisoption:"U:".
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
url<URL>
[Link](s)
inaconfigfile.
IfthegivenURLismissingaschemename(suchas"[Link]
[Link]
DICT,FTP,IMAP,LDAP,POP3orSMTPthenthatprotocolwillbeused,otherwise
HTTPwillbeused.Since7.45.0guessingcanbedisabledbysettingadefault
protocol,seeprotodefaultfordetails.
[Link],
usetheo,outputortheO,remotenameoptions.
v,verbose
Bemoreverbose/[Link]
what'sgoingon"underthehood".Alinestartingwith'>'means"headerdata"sentby
curl,'<'means"headerdata"receivedbycurlthatishiddeninnormalcases,anda
linestartingwith'*'meansadditionalinfoprovidedbycurl.
NotethatifyouonlywantHTTPheadersintheoutput,i,includemightbethe
optionyou'relookingfor.
Ifyouthinkthisoptionstilldoesn'tgiveyouenoughdetails,considerusingtraceor
traceasciiinstead.
Thisoptionoverridesprevioususesoftraceasciiortrace.
Uses,silenttomakecurlquiet.
w,writeout<format>
[Link]
[Link]
bespecifiedasaliteral"string",oryoucanhavecurlreadtheformatfromafilewith
"@filename"andtotellcurltoreadtheformatfromstdinyouwrite"@".
Thevariablespresentintheoutputformatwillbesubstitutedbythevalueortextthat
curlthinksfit,[Link]%{variable_name}
andtooutputanormal%youjustwritethemas%%.Youcanoutputanewlineby
using\n,acarriagereturnwith\randatabspacewith\t.
NOTE:The%symbolisaspecialsymbolinthewin32environment,whereall
[Link] 38/51
28/04/2016 cURLHowToUse
occurrencesof%mustbedoubledwhenusingthisoption.
Thevariablesavailableare:
content_typeTheContentTypeoftherequesteddocument,iftherewasany.
filename_effectiveTheultimatefilenamethatcurlwritesoutto.Thisisonly
meaningfulifcurlistoldtowritetoafilewiththeremotenameoroutput
[Link]'smostusefulincombinationwiththeremoteheadernameoption.
(Addedin7.26.0)
ftp_entry_pathTheinitialpathcurlendedupinwhenloggingontotheremote
FTPserver.(Addedin7.15.4)
http_codeThenumericalresponsecodethatwasfoundinthelastretrieved
HTTP(S)orFTP(s)transfer.In7.18.2thealiasresponse_codewasaddedto
showthesameinfo.
http_connectThenumericalcodethatwasfoundinthelastresponse(froma
proxy)toacurlCONNECTrequest.(Addedin7.12.4)
local_ipTheIPaddressofthelocalendofthemostrecentlydoneconnection
canbeeitherIPv4orIPv6(Addedin7.29.0)
local_portThelocalportnumberofthemostrecentlydoneconnection(Addedin
7.29.0)
num_connectsNumberofnewconnectsmadeintherecenttransfer.(Addedin
7.12.3)
num_redirectsNumberofredirectsthatwerefollowedintherequest.(Addedin
7.12.3)
redirect_urlWhenanHTTPrequestwasmadewithoutLtofollowredirects,this
variablewillshowtheactualURLaredirectwouldtakeyouto.(Addedin7.18.2)
remote_ipTheremoteIPaddressofthemostrecentlydoneconnectioncanbe
eitherIPv4orIPv6(Addedin7.29.0)
remote_portTheremoteportnumberofthemostrecentlydoneconnection
(Addedin7.29.0)
size_downloadThetotalamountofbytesthatweredownloaded.
size_headerThetotalamountofbytesofthedownloadedheaders.
size_requestThetotalamountofbytesthatweresentintheHTTPrequest.
size_uploadThetotalamountofbytesthatwereuploaded.
speed_downloadTheaveragedownloadspeedthatcurlmeasuredforthe
[Link].
speed_uploadTheaverageuploadspeedthatcurlmeasuredforthecomplete
[Link].
[Link] 39/51
28/04/2016 cURLHowToUse
ssl_verify_resultTheresultoftheSSLpeercertificateverificationthatwas
requested.0meanstheverificationwassuccessful.(Addedin7.19.0)
time_appconnectThetime,inseconds,ittookfromthestartuntilthe
SSL/SSH/etcconnect/handshaketotheremotehostwascompleted.(Addedin
7.19.0)
time_connectThetime,inseconds,ittookfromthestartuntiltheTCPconnect
totheremotehost(orproxy)wascompleted.
time_namelookupThetime,inseconds,ittookfromthestartuntilthename
resolvingwascompleted.
time_pretransferThetime,inseconds,ittookfromthestartuntilthefiletransfer
[Link]
negotiationsthatarespecifictotheparticularprotocol(s)involved.
time_redirectThetime,inseconds,ittookforallredirectionstepsincludename
lookup,connect,pretransferandtransferbeforethefinaltransactionwasstarted.
time_redirectshowsthecompleteexecutiontimeformultipleredirections.(Added
in7.12.3)
time_starttransferThetime,inseconds,ittookfromthestartuntilthefirstbyte
wasjustabouttobetransferred.Thisincludestime_pretransferandalsothetime
theserverneededtocalculatetheresult.
time_totalThetotaltime,inseconds,[Link]
bedisplayedwithmillisecondresolution.
url_effectiveTheURLthatwasfetchedlast.Thisismostmeaningfulifyou've
toldcurltofollowlocation:headers.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
x,proxy<[protocol://][user:password@]proxyhost[:port]>
Usethespecifiedproxy.
Theproxystringcanbespecifiedwithaprotocol://prefixtospecifyalternativeproxy
protocols.Usesocks4://,socks4a://,socks5://orsocks5h://torequestthespecific
[Link],[Link]
asHTTPproxies.(Theprotocolsupportwasaddedincurl7.21.7)
Iftheportnumberisnotspecifiedintheproxystring,itisassumedtobe1080.
[Link]
there'sanenvironmentvariablesettingaproxy,youcansetproxyto""tooverrideit.
AlloperationsthatareperformedoveranHTTPproxywilltransparentlybeconverted
[Link].
Thisisnotthecaseifyoucantunnelthroughtheproxy,asonewiththep,
proxytunneloption.
UserandpasswordthatmightbeprovidedintheproxystringareURLdecodedby
[Link]@byusing%40orpassin
acolonwith%3a.
[Link] 40/51
28/04/2016 cURLHowToUse
Theproxyhostcanbespecifiedtheexactsamewayastheproxyenvironment
variables,includingtheprotocolprefix([Link]
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
X,request<command>
(HTTP)Specifiesacustomrequestmethodtousewhencommunicatingwiththe
[Link]
otherwiseused(whichdefaultstoGET).ReadtheHTTP1.1specificationfordetails
[Link],but
relatedtechnologieslikeWebDAVoffersPROPFIND,COPY,MOVEandmore.
Normallyyoudon'[Link],HEAD,POSTandPUT
requestsareratherinvokedbyusingdedicatedcommandlineoptions.
ThisoptiononlychangestheactualwordusedintheHTTPrequest,itdoesnotalter
[Link],
[Link],headoption.
ThemethodstringyousetwithXwillbeusedforallrequests,whichifyoufor
exampleuseL,locationmaycauseunintendedsideeffectswhencurldoesn't
changerequestmethodaccordingtotheHTTP30xresponsecodesandsimilar.
(FTP)SpecifiesacustomFTPcommandtouseinsteadofLISTwhendoingfilelists
withFTP.
(POP3)SpecifiesacustomPOP3commandtouseinsteadofLISTorRETR.(Added
in7.26.0)
(IMAP)SpecifiesacustomIMAPcommandtouseinsteadofLIST.(Addedin7.30.0)
(SMTP)SpecifiesacustomSMTPcommandtouseinsteadofHELPorVRFY.
(Addedin7.34.0)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
xattr
Whensavingoutputtoafile,thisoptiontellscurltostorecertainfilemetadatain
[Link],[Link],
forHTTP,thecontenttypeisstoredinthemime_typeattribute.Ifthefilesystemdoes
notsupportextendedattributes,awarningisissued.
y,speedtime<time>
Ifadownloadisslowerthanspeedlimitbytespersecondduringaspeedtimeperiod,
[Link],thedefaultspeedlimitwillbe1
unlesssetwithY.
[Link]
concernforyou,trytheconnecttimeoutoption.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
Y,speedlimit<speed>
[Link] 41/51
28/04/2016 cURLHowToUse
Ifadownloadisslowerthanthisgivenspeed(inbytespersecond)forspeedtime
secondsitgetsaborted.speedtimeissetwithyandis30ifnotset.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
z,timecond<dateexpression>|<file>
(HTTP/FTP)Requestafilethathasbeenmodifiedlaterthanthegiventimeanddate,
[Link]<dateexpression>canbeall
sortsofdatestringsorifitdoesn'tmatchanyinternalones,itistakenasafilename
andtriestogetthemodificationdate(mtime)from<file>[Link]
curl_getdate(3)manpagesfordateexpressiondetails.
Startthedateexpressionwithadash()tomakeitrequestforadocumentthatis
olderthanthegivendate/time,defaultisadocumentthatisnewerthanthespecified
date/time.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
h,help
[Link].
M,manual
[Link].
V,version
Displaysinformationaboutcurlandthelibcurlversionituses.
Thefirstlineincludesthefullversionofcurl,libcurlandother3rdpartylibrarieslinked
withtheexecutable.
Thesecondline(startswith"Protocols:")showsallprotocolsthatlibcurlreportsto
support.
Thethirdline(startswith"Features:")showsspecificfeatureslibcurlreportstooffer.
Availablefeaturesinclude:
IPv6
YoucanuseIPv6withthis.
krb4
Krb4forFTPissupported.
SSL
SSLversionsofvariousprotocolsaresupported,suchasHTTPS,FTPS,POP3S
andsoon.
libz
AutomaticdecompressionofcompressedfilesoverHTTPissupported.
[Link] 42/51
28/04/2016 cURLHowToUse
NTLM
NTLMauthenticationissupported.
Debug
[Link]
[Link]!
AsynchDNS
[Link]
bedoneusingeitherthecaresorthethreadedresolverbackends.
SPNEGO
SPNEGOauthenticationissupported.
Largefile
Thiscurlsupportstransfersoflargefiles,fileslargerthan2GB.
IDN
ThiscurlsupportsIDNinternationaldomainnames.
GSSAPI
GSSAPIissupported.
SSPI
SSPIissupported.
TLSSRP
SRP(SecureRemotePassword)authenticationissupportedforTLS.
HTTP2
HTTP/2supporthasbeenbuiltin.
Metalink
ThiscurlsupportsMetalink(bothversion3and4(RFC5854)),whichdescribes
[Link](suchas
thefileorservernotbeingavailable).
FILES
~/.curlrc
Defaultconfigfile,seeK,configfordetails.
ENVIRONMENT
[Link] 43/51
28/04/2016 cURLHowToUse
[Link]
versionhasprecedence.http_proxyisanexceptionasitisonlyavailableinlowercase.
Usinganenvironmentvariabletosettheproxyhasthesameeffectasusingtheproxy
option.
http_proxy[protocol://]<host>[:port]
SetstheproxyservertouseforHTTP.
HTTPS_PROXY[protocol://]<host>[:port]
SetstheproxyservertouseforHTTPS.
[urlprotocol]_PROXY[protocol://]<host>[:port]
Setstheproxyservertousefor[urlprotocol],wheretheprotocolisaprotocolthatcurl
[Link],FTPS,POP3,IMAP,SMTP,LDAPetc.
ALL_PROXY[protocol://]<host>[:port]
Setstheproxyservertouseifnoprotocolspecificproxyisset.
NO_PROXY<commaseparatedlistofhosts>
listofhostnamesthatshouldn'[Link]'*'only,it
matchesallhosts.
PROXYPROTOCOLPREFIXES
Sincecurlversion7.21.7,theproxystringmaybespecifiedwithaprotocol://prefixto
specifyalternativeproxyprotocols.
Ifnoprotocolisspecifiedintheproxystringorifthestringdoesn'tmatchasupportedone,
theproxywillbetreatedasanHTTPproxy.
Thesupportedproxyprotocolprefixesareasfollows:
socks4://
Makesittheequivalentofsocks4
socks4a://
Makesittheequivalentofsocks4a
socks5://
Makesittheequivalentofsocks5
socks5h://
Makesittheequivalentofsocks5hostname
EXITCODES
[Link] 44/51
28/04/2016 cURLHowToUse
Thereareabunchofdifferenterrorcodesandtheircorrespondingerrormessagesthat
[Link],theexitcodesare:
[Link].
Failedtoinitialize.
[Link].
Afeatureoroptionthatwasneededtoperformthedesiredrequestwasnotenabled
[Link],youprobably
needanotherbuildoflibcurl!
Couldn'[Link].
Couldn'[Link].
Failedtoconnecttohost.
[Link]'tparse.
[Link]
[Link]
directorythatdoesn'texistontheserver.
11
[Link]'tparsethereplysenttothePASSrequest.
13
FTPweirdPASVreply,Curlcouldn'tparsethereplysenttothePASVrequest.
14
[Link]'tparsethe227linetheserversent.
15
[Link] 45/51
28/04/2016 cURLHowToUse
FTPcan'[Link]'tresolvethehostIPwegotinthe227line.
17
FTPcouldn'[Link]'tchangetransfermethodtobinary.
18
[Link].
19
FTPcouldn'tdownload/accessthegivenfile,theRETR(orsimilar)commandfailed.
21
[Link].
22
[Link]
[Link],fail
isused.
23
[Link]'twritedatatoalocalfilesystemorsimilar.
25
FTPcouldn'[Link],usedforFTP
uploading.
26
[Link].
27
[Link].
28
[Link]
conditions.
30
[Link]
command,trydoingatransferusingPASVinstead!
31
FTPcouldn'[Link]
resumedFTPtransfers.
33
[Link] 46/51
28/04/2016 cURLHowToUse
[Link]"command"didn'twork.
34
[Link].
35
[Link].
36
[Link]'tcontinueanearlieraborteddownload.
37
FILEcouldn'[Link]?
38
[Link].
39
LDAPsearchfailed.
41
[Link].
42
[Link].
43
[Link].
45
[Link].
47
[Link],curlhitthemaximumamount.
48
[Link]
[Link]!
49
Malformedtelnetoption.
51
[Link] 47/51
28/04/2016 cURLHowToUse
Thepeer'sSSLcertificateorSSHMD5fingerprintwasnotOK.
52
Theserverdidn'treplyanything,whichhereisconsideredanerror.
53
SSLcryptoenginenotfound.
54
CannotsetSSLcryptoengineasdefault.
55
Failedsendingnetworkdata.
56
Failureinreceivingnetworkdata.
58
Problemwiththelocalcertificate.
59
Couldn'tusespecifiedSSLcipher.
60
PeercertificatecannotbeauthenticatedwithknownCAcertificates.
61
Unrecognizedtransferencoding.
62
InvalidLDAPURL.
63
Maximumfilesizeexceeded.
64
RequestedFTPSSLlevelfailed.
65
Sendingthedatarequiresarewindthatfailed.
66
FailedtoinitialiseSSLEngine.
[Link] 48/51
28/04/2016 cURLHowToUse
67
Theusername,password,orsimilarwasnotacceptedandcurlfailedtologin.
68
FilenotfoundonTFTPserver.
69
PermissionproblemonTFTPserver.
70
OutofdiskspaceonTFTPserver.
71
IllegalTFTPoperation.
72
UnknownTFTPtransferID.
73
Filealreadyexists(TFTP).
74
Nosuchuser(TFTP).
75
Characterconversionfailed.
76
Characterconversionfunctionsrequired.
77
ProblemwithreadingtheSSLCAcert(path?accessrights?).
78
TheresourcereferencedintheURLdoesnotexist.
79
AnunspecifiederroroccurredduringtheSSHsession.
80
FailedtoshutdowntheSSLconnection.
82
[Link] 49/51
28/04/2016 cURLHowToUse
CouldnotloadCRLfile,missingorwrongformat(addedin7.19.0).
83
Issuercheckfailed(addedin7.19.0).
84
TheFTPPRETcommandfailed
85
RTSP:mismatchofCSeqnumbers
86
RTSP:mismatchofSessionIdentifiers
87
unabletoparseFTPfilelist
88
FTPchunkcallbackreportederror
89
Noconnectionavailable,thesessionwillbequeued
90
SSLpublickeydoesnotmatchedpinnedpublickey
XX
[Link]
neverchange.
AUTHORS/CONTRIBUTORS
DanielStenbergisthemainauthor,butthewholelistofcontributorsisfoundinthe
separateTHANKSfile.
WWW
[Link]
FTP
[Link]
SEEALSO
[Link] 50/51
28/04/2016 cURLHowToUse
ftp(1),wget(1)
ThisHTMLpagewasmadewithroffit.
[Link] 51/51