* This example shows how to make a simple request with curl. */
| 8 | * This example shows how to make a simple request with curl. |
| 9 | */ |
| 10 | int main() { |
| 11 | // Easy object to handle the connection. |
| 12 | curl_easy easy; |
| 13 | |
| 14 | // Add some options. |
| 15 | easy.add<CURLOPT_URL>("http://www.google.it"); |
| 16 | easy.add<CURLOPT_FOLLOWLOCATION>(1L); |
| 17 | |
| 18 | try { |
| 19 | easy.perform(); |
| 20 | } catch (curl_easy_exception &error) { |
| 21 | // If you want to print the last error. |
| 22 | std::cerr<<error.what()<<std::endl; |
| 23 | } |
| 24 | return 0; |
| 25 | } |