~ubuntu-branches/ubuntu/quantal/curl/quantal

« back to all changes in this revision

Viewing changes to docs/libcurl/libcurl.html

  • Committer: Bazaar Package Importer
  • Author(s): Domenico Andreoli
  • Date: 2002-03-12 19:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20020312190621-iqx7k9cipo5d0ifr
Tags: upstream-7.9.5
Import upstream version 7.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<BODY>
 
3
<PRE>
 
4
<!-- Manpage converted by man2html 3.0.1 -->
 
5
 
 
6
</PRE>
 
7
<H2>NAME</H2><PRE>
 
8
     libcurl - client-side URL transfers
 
9
 
 
10
 
 
11
</PRE>
 
12
<H2>DESCRIPTION</H2><PRE>
 
13
     This  is  an  overview  on how to use libcurl in your C pro�
 
14
     grams. There are specific man pages for each  function  men�
 
15
     tioned  in here. There's also the libcurl-the-guide document
 
16
     for a complete tutorial to programming with libcurl.
 
17
 
 
18
     libcurl can also be used directly  from  within  your  Java,
 
19
     PHP,  Perl, Ruby or Tcl programs as well, look elsewhere for
 
20
     documentation on this!
 
21
 
 
22
     All   applications   that   use    libcurl    should    call
 
23
     <I>curl</I><B>_</B><I>global</I><B>_</B><I>init()</I>  exactly once before any libcurl function
 
24
     can be used. After all usage of libcurl is complete, it <B>must</B>
 
25
     call  <I>curl</I><B>_</B><I>global</I><B>_</B><I>cleanup()</I>. In between those two calls, you
 
26
     can use libcurl as described below.
 
27
 
 
28
     When using libcurl you init your session and get  a  handle,
 
29
     which  you use as input to the following interface functions
 
30
     you use. Use <I>curl</I><B>_</B><I>easy</I><B>_</B><I>init()</I> to get the handle.
 
31
 
 
32
     You continue by setting all the  options  you  want  in  the
 
33
     upcoming  transfer,  most  important  among  them is the URL
 
34
     itself (you can't transfer anything without a specified  URL
 
35
     as you may have figured out yourself). You might want to set
 
36
     some callbacks as well that will be called from the  library
 
37
     when data is available etc.  <I>curl</I><B>_</B><I>easy</I><B>_</B><I>setopt()</I> is there for
 
38
     this.
 
39
 
 
40
     When all is setup, you tell libcurl to perform the  transfer
 
41
     using <I>curl</I><B>_</B><I>easy</I><B>_</B><I>perform()</I>.  It will then do the entire oper�
 
42
     ation and won't return until it  is  done  (successfully  or
 
43
     not).
 
44
 
 
45
     After  the  transfer  has been made, you can set new options
 
46
     and make another transfer, or if you're  done,  cleanup  the
 
47
     session by calling <I>curl</I><B>_</B><I>easy</I><B>_</B><I>cleanup()</I>.  If you want persis�
 
48
     tant connections, you don't cleanup immediately, but instead
 
49
     run ahead and perform other transfers using the same handle.
 
50
     See the chapter below for Persistant Connections.
 
51
 
 
52
     There is also a series of other helpful  functions  to  use.
 
53
     They are:
 
54
 
 
55
 
 
56
          <B>curl_version()</B>
 
57
                    displays the libcurl version
 
58
 
 
59
          <B>curl_getdate()</B>
 
60
                    converts a date string to time_t
 
61
 
 
62
          <B>curl_getenv()</B>
 
63
                    portable environment variable reader
 
64
 
 
65
          <B>curl_easy_getinfo()</B>
 
66
                    get information about a performed transfer
 
67
 
 
68
          <B>curl_formadd()</B>
 
69
                    helps building a HTTP form POST
 
70
 
 
71
          <B>curl_formfree()</B>
 
72
                    free    a    list   built   with   curl_form�
 
73
                    parse()/curl_formadd()
 
74
 
 
75
          <B>curl_slist_append()</B>
 
76
                    builds a linked list
 
77
 
 
78
          <B>curl_slist_free_all()</B>
 
79
                    frees a whole curl_slist
 
80
 
 
81
          <B>curl_mprintf()</B>
 
82
                    portable printf() functions
 
83
 
 
84
          <B>curl_strequal()</B>
 
85
                    portable case insensitive string comparisons
 
86
 
 
87
 
 
88
 
 
89
</PRE>
 
90
<H2>LINKING WITH LIBCURL</H2><PRE>
 
91
     Starting with 7.7.2 (on unix-like machines), there's a  tool
 
92
     named  curl-config  that gets installed with the rest of the
 
93
     curl stuff when 'make install' is performed.
 
94
 
 
95
     curl-config is added to make it easier for  applications  to
 
96
     link  with libcurl and developers to learn about libcurl and
 
97
     how to use it.
 
98
 
 
99
     Run 'curl-config --libs'  to  get  the  (additional)  linker
 
100
     options  you  need  to  link  with the particular version of
 
101
     libcurl you've installed.
 
102
 
 
103
     For details, see the curl-config.1 man page.
 
104
 
 
105
 
 
106
</PRE>
 
107
<H2>LIBCURL SYMBOL NAMES</H2><PRE>
 
108
     All public functions in the libcurl interface  are  prefixed
 
109
     with  'curl_' (with a lowercase c). You can find other func�
 
110
     tions in the library source code, but other  prefixes  indi�
 
111
     cate  the  functions are private and may change without fur�
 
112
     ther notice in the next release.
 
113
 
 
114
     Only use documented functions and functionality!
 
115
 
 
116
 
 
117
</PRE>
 
118
<H2>PORTABILITY</H2><PRE>
 
119
     libcurl works <B>exactly</B> the same, on any of the  platforms  it
 
120
     compiles and builds on.
 
121
 
 
122
     There's  only  one  caution,  and that is the win32 platform
 
123
     that may(*) require you to init the winsock stuff before you
 
124
     use  the libcurl functions. Details on this are noted on the
 
125
     curl_easy_init() man page.
 
126
 
 
127
     (*) = it appears as if users of the cygwin  environment  get
 
128
     this  done  automatically,  also libcurl 7.8.1 and later can
 
129
     handle this for you.
 
130
 
 
131
 
 
132
</PRE>
 
133
<H2>THREADS</H2><PRE>
 
134
     Never ever call curl-functions simultaneously using the same
 
135
     handle  from several threads. libcurl is thread-safe and can
 
136
     be used in any number of threads, but you must use  separate
 
137
     curl  handles  if  you  want to use libcurl in more than one
 
138
     thread simultaneously.
 
139
 
 
140
 
 
141
</PRE>
 
142
<H2>PERSISTANT CONNECTIONS</H2><PRE>
 
143
     With libcurl 7.7, persistant connections were added. Persis�
 
144
     tant connections means that libcurl can re-use the same con�
 
145
     nection for several transfers, if the conditions are  right.
 
146
 
 
147
     libcurl will *always* attempt to use persistant connections.
 
148
     Whenever you use curl_easy_perform(), libcurl  will  attempt
 
149
     to  use  an  existing  connection to do the transfer, and if
 
150
     none exists it'll open a new one that will  be  subject  for
 
151
     re-use  on a possible following call to curl_easy_perform().
 
152
 
 
153
     To allow libcurl to take full advantage of  persistant  con�
 
154
     nections,  you  should  do as many of your file transfers as
 
155
     possible  using  the  same  curl  handle.  When   you   call
 
156
     curl_easy_cleanup(),  all the possibly open connections held
 
157
     by libcurl will be closed and forgotten.
 
158
 
 
159
     Note that the options set with  curl_easy_setopt()  will  be
 
160
     used in on every repeat curl_easy_perform() call
 
161
 
 
162
 
 
163
</PRE>
 
164
<H2>COMPATIBILITY WITH OLDER LIBCURLS</H2><PRE>
 
165
     Repeated  curl_easy_perform()  calls on the same handle were
 
166
     not supported in pre-7.7 versions, and caused confusion  and
 
167
     undefined behaviour.
 
168
 
 
169
 
 
170
 
 
171
 
 
172
 
 
173
 
 
174
 
 
175
 
 
176
 
 
177
 
 
178
</PRE>
 
179
<HR>
 
180
<ADDRESS>
 
181
Man(1) output converted with
 
182
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
 
183
</ADDRESS>
 
184
</BODY>
 
185
</HTML>