在C中使用cURL的HTTP代理 [英] use of HTTP Proxy using cURL in C

查看:494
本文介绍了在C中使用cURL的HTTP代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在这个项目使用代理服务器和curl在c和我不能找到一个很好的教程教我如何。你能帮我么??我需要一个示例代码,显示使用代理服务器连接到google.com。可能使用CURLOPT_PROXY选项..
提前感谢。

I'm working on this project that uses proxy server and curl in c and i cant find a good tutorial that teaches me how to. Can you please help me?? i need an example code that shows the use of a proxy server to connect to google.com. maybe using the CURLOPT_PROXY option.. Thanks in advance.

推荐答案

http://curl.haxx.se/libcurl/c/libcurl-tutorial.html =nofollow> normal curl 检索,但只需设置代理服务器选项。

Well all you do is your normal curl retrieval, but just set the proxy server option.

   curl_easy_setopt(handle, CURLOPT_PROXY, "127.0.0.1:96666");

EDIT

  /* create headers */
  struct curl_slist *headers=NULL;
  headers = curl_slist_append(headers, "Content-Type: text/xml");

  /* pass our list of custom made headers */
  curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers);

这篇关于在C中使用cURL的HTTP代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆