• <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

            文章均收錄自他人博客,但不喜標題前加-[轉貼],因其丑陋,見諒!~
            隨筆 - 1469, 文章 - 0, 評論 - 661, 引用 - 0
            數據加載中……

            Libcurl 簡明使用指南

            Libcurl為一個免費開源的,客戶端url傳輸庫,支持FTPFTPSTFTPHTTPHTTPSGOPHERTELNETDICTFILELDAP,跨平臺,支持WindowsUnixLinux等,線程安全,支持Ipv6。并且易于使用。

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

             

            http://curl.haxx.se/libcurl/ 下載一個穩定的版本,注意選擇OS

             

            編譯libcurl

            下載下來的是源碼包,需要編譯。

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

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

            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版本。新建一個批處理文件BuildRelease.bat,內容如下:

            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版本。如果沒有,可以從www.openssl.org 或者http://www.zlib.net/ 下載。

            如果需要編譯其他版本,可查看Makefile.vc6,設定相應的CFG 參數即可。

             

            商業軟件使用libcurl時,只需要包含其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 肥仔 閱讀(6247) 評論(2)  編輯 收藏 引用 所屬分類: 網絡編程

            評論

            # re: Libcurl 簡明使用指南  回復  更多評論   

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

            # re: Libcurl 簡明使用指南  回復  更多評論   

            真是個垃圾.一點創意都沒有,抄得這么徹底.
            2011-04-07 09:32 | aa
            久久人妻少妇嫩草AV蜜桃| 色噜噜狠狠先锋影音久久| 久久免费视频观看| 久久亚洲AV无码精品色午夜| 国内精品久久久久久久涩爱| 99久久99久久精品国产片果冻| 久久精品国产亚洲77777| 精品无码久久久久久午夜| 亚洲AV无码久久| 久久久精品2019免费观看| 久久人人爽人人爽人人片AV不| 国产精品一区二区久久国产| 久久精品国产99久久久| 国产成人久久激情91| 国产精品久久99| 久久91这里精品国产2020| 亚洲成av人片不卡无码久久| 国产色综合久久无码有码| 久久久噜噜噜www成人网| 久久综合九色综合97_久久久| 99久久99久久精品免费看蜜桃| 91精品国产综合久久香蕉 | 伊人精品久久久久7777| 久久久亚洲欧洲日产国码是AV| 91麻豆国产精品91久久久| 久久免费视频1| 国产成人综合久久综合| 久久se精品一区二区影院| 久久久久久精品无码人妻| 色综合色天天久久婷婷基地| 人人狠狠综合久久亚洲| 久久精品国产亚洲精品2020 | 欧美伊人久久大香线蕉综合| 无码久久精品国产亚洲Av影片| 久久久久久久99精品免费观看| 亚洲精品无码专区久久同性男| 久久香蕉国产线看观看精品yw| 久久无码人妻精品一区二区三区| 亚洲国产精品无码久久一线 | 精品国产99久久久久久麻豆| 一本大道加勒比久久综合|