ChinaUnix.net
相关文章推荐:

libcurl 多线程

我在Linux下的线程中使用libcurl获取http数据时候遇到了个奇怪的问题 我测试了大约300个url地址, 基本上有一半的url地址是可以正常取得数据的 有差不一半的在访问url的时候提示失败 libcurl 错误日记显示 不能解析host, 或者不能连接到服务器, 那些出错的我都用浏览器测试过了,网站是正常的。 不知道有没有人遇到这个问题, 后来我换libfetch也测试了一下, 出错的要少点,但还是有不少的url地址访问失败。

by sulilo - C/C++ - 2011-11-21 11:06:56 阅读(5035) 回复(4)

libcurllibfetch

相关讨论

本帖最后由 kanhfshiys 于 2011-07-08 14:43 编辑 如题!

by kanhfshiys - C/C++ - 2011-07-09 10:52:05 阅读(5305) 回复(3)

现在都快让这个问题折腾的无奈了 我将这些网址保存在一个url.txt文件中,然后在程序中逐行读取 如:url.txt的内容为: 程序的关键代码如下: while(fgets(html, 120, srcf)) { imgfile.filename = strrchr(html, '/'); imgfile.filename += 1; curl_easy_setopt(curl, CURLOPT_URL, html); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_image); //设置回调函数 curl_easy_setopt(curl,...

by GodPig - C/C++ - 2008-01-13 16:46:58 阅读(2373) 回复(1)

系统是debian 6.0, 想让libcurl支持ssl, ssh, idn. openssh, ssh2均装在/usr/lib下, libcurl可以编译安装,装在/usr/local/lib下,可是在编译应用的时候总是出错,关于ssh2的函数引用未定义。有没有前辈碰到过同样的问题,怎么解决的,谢谢!

by keithnwsuaf - C/C++ - 2011-02-23 09:19:08 阅读(2136) 回复(3)

问个问题啊,发现有几个https居然不能正常访问,比如下面这个 curl_easy_setopt(curl, CURLOPT_URL, "https://loginchina.alibaba.com/member/signin.htm"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);打开调试,发现一直会跳转,一直跳转到127.0.0.1,返回Co...

by c/unix - C/C++ - 2013-03-31 14:54:21 阅读(1555) 回复(1)

请教一下,我是用libcurl库下载网页数据,在自己的机器上可以获取到完整数据,可是在服务器上就不可以,是代码编写的问题,还是libcurl在高并发的环境下需要做设置? 现在我把可以稳定运行的代码,和我自己修改的代码,贴出来,请大家指教一下。 老版本,可稳定运行,回调函数中 wr_index,wr_buf变量时全局的 int get_curl2buf(char *url) { CURL *curl; CURLcode ret; wr_index = 0; curl = curl_easy_init(); if (!curl...

by tianhailong - C/C++ - 2013-07-17 14:49:40 阅读(5014) 回复(2)

新写的一个程序打算用libcurl库实现上传文件功能。下面是实现ftp功能的函数。主函数中不调用该函数执行后用top查看(VIRT RES).基本能保持在一个固定值。调用该函数后(VIRT RES).都会逐渐增大。这是啥原因?是函数哪里有问题?需要怎么修正? int ftpupload(char *ip,char *account,char *logfile) { char full_path[PATH_MAX],*logbasename,remote_url[PATH_MAX]; CURL *curl; CURLcode res; FILE *hd_src; //计算日志全完...

by yuipr - C/C++ - 2009-08-28 11:33:11 阅读(1492) 回复(0)

curl是开源的东西,主要用于页面下载和上传 1、对于页面跳转的网站,最好先用sniffer把http数据包全部抓下,分析协议头,尤其是要对应好post后的url地址,以及记住cookie中的session_id(情况根据各网站会有所差别)。 2、 curl_easy_setopt(curl,CURLOPT_POST,1); 使用POST方式 3、curl_easy_setopt(curl,CURLOPT_POSTFIELDS,buffer) buffer对应content中的内容,类似"name=zhangsan&pwd=1234&Submit2=%B5%C7+%C2%BC&oriurl=%2F&...

by liu277325073 - Linux文档专区 - 2008-07-15 17:11:03 阅读(1456) 回复(0)

Using cURL and libcurl with PHP Intended Audience This tutorial is intended for PHP programmers and web developers interested in using their webserver to transfer files or communicate with other servers. You will need some general knowledge of client-server protocol on the Internet, and a basic knowledge of PHP syntax. Overview cURL and libcurl are libaries that allow a webserver to transfer files...

by liuxingyuyuni - php文档中心 - 2008-04-22 12:08:17 阅读(1177) 回复(0)

CROSS COMPILE ============= (This section was graciously brought to us by Jim Duey, with additions by Dan Fandrich) Download and unpack the cURL package. Version should be 7.9.1 or later. 'cd' to the new directory. (e.g. cd curl-7.12.3) Set environment variables to point to the cross-compile toolchain and call configure with any options you need. Be sure and specify the...

by gaocheng - Linux文档专区 - 2007-09-21 20:57:01 阅读(1243) 回复(0)

在window平台下 ,我把libcurl下载下来 ,然后写个很简单一个程序调用libcurl #include "curl/curl.h" #include "curl/easy.h" int main() { CURL *hdl = curl_easy_init(); return 1; } 编译的时候报:main.obj : error LNK2019: 无法解析的外部符号 __imp__curl_easy_init 我已经把curl.lib加入工程中了,怎么会这样呢?

by chestnut king - C/C++ - 2006-03-10 17:20:50 阅读(2481) 回复(0)