• <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 肥仔 閱讀(6255) 評論(2)  編輯 收藏 引用 所屬分類: 網絡編程

            評論

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

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

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

            真是個垃圾.一點創意都沒有,抄得這么徹底.
            2011-04-07 09:32 | aa
            一本久道久久综合狠狠爱| 国产精品熟女福利久久AV| 性做久久久久久免费观看| 久久久久国产亚洲AV麻豆| 亚洲午夜无码AV毛片久久| 亚洲国产精品一区二区久久hs| 婷婷伊人久久大香线蕉AV | 久久亚洲国产最新网站| 欧美一区二区三区久久综| 99久久国产综合精品成人影院| 亚洲国产精品无码久久久久久曰| 久久香蕉国产线看观看精品yw| 国产成人精品久久一区二区三区av| 一级做a爰片久久毛片看看| 青青青国产精品国产精品久久久久 | 久久精品无码专区免费青青 | 精品久久久久久无码人妻热| 亚洲伊人久久精品影院| 亚洲综合精品香蕉久久网97| 亚洲AV无码1区2区久久| 久久久久婷婷| 国产精品成人99久久久久| 久久国产免费观看精品3| 亚洲精品无码久久久久| 亚洲午夜无码久久久久小说| 国产精品久久久久久久久久免费| 久久免费的精品国产V∧| 欧美日韩久久中文字幕| 亚洲美日韩Av中文字幕无码久久久妻妇| 国产亚洲美女精品久久久久狼| 中文精品久久久久人妻不卡| 思思久久99热只有频精品66| 久久久久亚洲精品男人的天堂| 99久久免费只有精品国产| 久久99热狠狠色精品一区| 久久99精品久久久久久久不卡| 亚洲午夜久久久久久久久电影网| 伊人色综合九久久天天蜜桃| 香蕉久久永久视频| 久久这里有精品视频| 亚洲综合久久夜AV |