• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            woaidongmao

            文章均收錄自他人博客,但不喜標(biāo)題前加-[轉(zhuǎn)貼],因其丑陋,見(jiàn)諒!~
            隨筆 - 1469, 文章 - 0, 評(píng)論 - 661, 引用 - 0
            數(shù)據(jù)加載中……

            Libcurl 簡(jiǎn)明使用指南

            Libcurl為一個(gè)免費(fèi)開(kāi)源的,客戶端url傳輸庫(kù),支持FTP,FTPS,TFTPHTTPHTTPSGOPHER,TELNET,DICT,FILELDAP,跨平臺(tái),支持Windows,Unix,Linux等,線程安全,支持Ipv6。并且易于使用。

            http://curl.haxx.se/libcurl/

             

            http://curl.haxx.se/libcurl/ 下載一個(gè)穩(wěn)定的版本,注意選擇OS。

             

            編譯libcurl

            下載下來(lái)的是源碼包,需要編譯。

            解壓zip文件,進(jìn)入curl-7.14.0\lib目錄(我下載的是7.14.0)。

            編譯Debug版本。新建一個(gè)批處理bat文件,如buildDebug.bat,內(nèi)容如下:

            call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"

            set CFG=debug-dll-ssl-dll-zlib-dll

            set OPENSSL_PATH=E:\SSL\openssl-0.9.7e

            set ZLIB_PATH=E:\zip\zlib123

            nmake -f Makefile.vc6

             

            其輸出:libcurld_imp.lib, libcurld.dll

             

            編譯Release版本。新建一個(gè)批處理文件BuildRelease.bat,內(nèi)容如下:

            call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"

            set CFG=release-dll-ssl-dll-zlib-dll

            set OPENSSL_PATH=E:\SSL\openssl-0.9.7e

            set ZLIB_PATH=E:\zip\zlib123

            nmake -f Makefile.vc6

             

            其輸出:libcurl_imp.lib, libcurl.dll

             

            上面編譯的是libcurl dll,使用OpenSSL Dll版本和Zlib Dll版本。如果沒(méi)有,可以從www.openssl.org 或者http://www.zlib.net/ 下載。

            如果需要編譯其他版本,可查看Makefile.vc6,設(shè)定相應(yīng)的CFG 參數(shù)即可。

             

            商業(yè)軟件使用libcurl時(shí),只需要包含其copywrite聲明即可。

             

            Sample

             

            clip_image001#include <stdio.h>
            clip_image001#include "../curl-7.14.0/include/curl/curl.h"
            clip_image001#pragma comment(lib, "../curl-7.14.0/lib/libcurl_imp.lib")
            clip_image001
            clip_image001
            int main(void)
            clip_image002clip_image003clip_image004{
            clip_image005  curl = curl_easy_init();
            clip_image006clip_image007 
            if(curl) clip_image004{
            clip_image005
            clip_image005    CURLcode res;   
            clip_image005    res = curl_easy_setopt(curl, CURLOPT_PROXY, "Test-pxy08:8080");
            clip_image005    res = curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
            clip_image005    res = curl_easy_setopt(curl, CURLOPT_URL, "http://www.vckbase.com");
            clip_image005    res = curl_easy_perform(curl);
            clip_image005
            clip_image006clip_image007   
            if(CURLE_OK == res) clip_image004{
            clip_image005     
            char *ct;
            clip_image006clip_image007      /**//* ask for the content-type */

            clip_image006clip_image007      /**//* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */

            clip_image005      res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
            clip_image005
            clip_image005     
            if((CURLE_OK == res) && ct)
            clip_image005        printf("We received Content-Type: %s ", ct);
            clip_image008    }

            clip_image005
            clip_image006clip_image007    /**//* always cleanup */

            clip_image005    curl_easy_cleanup(curl);
            clip_image008  }

            clip_image005 
            return 0;
            clip_image009}

             

            posted on 2009-03-13 12:05 肥仔 閱讀(6260) 評(píng)論(2)  編輯 收藏 引用 所屬分類(lèi): 網(wǎng)絡(luò)編程

            評(píng)論

            # re: Libcurl 簡(jiǎn)明使用指南  回復(fù)  更多評(píng)論   

            看不懂
            2010-09-23 20:07 | 廖海桃

            # re: Libcurl 簡(jiǎn)明使用指南  回復(fù)  更多評(píng)論   

            真是個(gè)垃圾.一點(diǎn)創(chuàng)意都沒(méi)有,抄得這么徹底.
            2011-04-07 09:32 | aa
            伊人久久大香线蕉AV一区二区 | 久久久久亚洲?V成人无码| 潮喷大喷水系列无码久久精品| 久久亚洲AV成人无码国产| 99久久精品国产一区二区| 伊人久久精品影院| 久久综合九色综合欧美狠狠| 久久精品无码一区二区app| 亚洲va久久久噜噜噜久久天堂| 国产ww久久久久久久久久| 一本色道久久综合狠狠躁| 久久亚洲高清观看| 亚洲AV无码成人网站久久精品大| 免费精品99久久国产综合精品| 亚洲一级Av无码毛片久久精品| 久久婷婷综合中文字幕| 亚洲午夜久久久影院| 人妻中文久久久久| 99久久精品免费看国产一区二区三区 | 国内精品伊人久久久久妇| 99久久精品费精品国产| 久久人人爽人人爽人人AV东京热| 午夜精品久久久久成人| 国产精品日韩深夜福利久久 | 日韩影院久久| 久久性精品| 色偷偷91久久综合噜噜噜噜| 亚洲国产成人久久综合一| 国内高清久久久久久| 中文字幕乱码久久午夜| 久久天天躁狠狠躁夜夜躁2014| 久久人人爽人人爽人人片AV麻豆 | 91精品国产综合久久精品| 亚洲国产欧美国产综合久久| 伊人久久大香线蕉成人| 国产A三级久久精品| 久久久久久久女国产乱让韩| 久久久久青草线蕉综合超碰| 国产A级毛片久久久精品毛片| 亚洲AV日韩精品久久久久| 无码人妻久久一区二区三区|