简体   繁体   English

使用libcurl访问代理

[英]Using libcurl to access proxy

I want to access a proxy using libcurl in my C code. 我想在我的C代码中使用libcurl访问代理。 I read that with this command I can configure libcurl to access the proxy: 我读到以下命令可以配置libcurl来访问代理:

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

But is that all I have to do? 但这就是我所要做的吗? Do I need to open a socket? 我需要打开插座吗?

Any tip will be very helpful, 任何提示都会非常有帮助,

Thanks. 谢谢。

Yes, that's all you need - assuming it is a HTTP proxy and you fix the port number, because 96666 is not a valid port! 是的,这就是您所需要的-假设它是一个HTTP代理,并且您修复了端口号,因为96666不是有效的端口! :-) :-)

See the CURLOPT_PROXY man page for more details. 有关更多详细信息,请参见CURLOPT_PROXY手册页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM