Base code merged to SPIN 2.4
[platform/upstream/curl.git] / docs / libcurl / curl_easy_perform.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at http://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .TH curl_easy_perform 3 "5 Mar 2001" "libcurl 7.7" "libcurl Manual"
23 .SH NAME
24 curl_easy_perform - perform a blocking file transfer
25 .SH SYNOPSIS
26 .B #include <curl/curl.h>
27 .sp
28 .BI "CURLcode curl_easy_perform(CURL *" easy_handle ");"
29 .ad
30 .SH DESCRIPTION
31 Invoke this function after \fIcurl_easy_init(3)\fP and all the
32 \fIcurl_easy_setopt(3)\fP calls are made, and will perform the transfer as
33 described in the options. It must be called with the same \fBeasy_handle\fP as
34 input as the \fIcurl_easy_init(3)\fP call returned.
35
36 \fIcurl_easy_perform(3)\fP performs the entire request in a blocking manner
37 and returns when done, or if it failed. For non-blocking behavior, see
38 \fIcurl_multi_perform(3)\fP.
39
40 You can do any amount of calls to \fIcurl_easy_perform(3)\fP while using the
41 same \fBeasy_handle\fP. If you intend to transfer more than one file, you are
42 even encouraged to do so. libcurl will then attempt to re-use the same
43 connection for the following transfers, thus making the operations faster,
44 less CPU intense and using less network resources. Just note that you will
45 have to use \fIcurl_easy_setopt(3)\fP between the invokes to set options for
46 the following curl_easy_perform.
47
48 You must never call this function simultaneously from two places using the
49 same \fBeasy_handle\fP. Let the function return first before invoking it
50 another time. If you want parallel transfers, you must use several curl
51 easy_handles.
52
53 While the \fBeasy_handle\fP is added to a multi handle, it cannot be used by
54 \fIcurl_easy_perform(3)\fP.
55 .SH RETURN VALUE
56 CURLE_OK (0) means everything was ok, non-zero means an error occurred as
57 .I <curl/curl.h>
58 defines - see \fIlibcurl-errors(3)\fP. If the \fBCURLOPT_ERRORBUFFER(3)\fP was
59 set with \fIcurl_easy_setopt(3)\fP there will be a readable error message in
60 the error buffer when non-zero is returned.
61 .SH EXAMPLE
62 .nf
63 CURL *curl = curl_easy_init();
64 if(curl) {
65   CURLcode res;
66   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
67   res = curl_easy_perform(curl);
68   curl_easy_cleanup(curl);
69 }}
70 .fi
71 .SH "SEE ALSO"
72 .BR curl_easy_init "(3), " curl_easy_setopt "(3), "
73 .BR curl_multi_add_handle "(3), " curl_multi_perform "(3), "
74 .BR libcurl-errors "(3), "
75