Professional Web Applications Themes

Any OSX libcurl experts? - Mac Programming

Hello, Is there anyone could walk me through building/including/using libcurl in a CW OSX project? I can use Curl in the terminal OK, and just need the equivalent of this functionality: curl -T Test.txt -u user:password ftp://ftp.MyFTP.com/uploadTest I've been going round in circles looking at the mass of Unix-like stuff in the libcurl package, but can't find an 'in' point to get it running on OSX. Any advice greatly appreciated. Thanks Steve...

  1. #1

    Default Any OSX libcurl experts?

    Hello,

    Is there anyone could walk me through building/including/using libcurl
    in a CW OSX project?

    I can use Curl in the terminal OK, and just need the equivalent of this
    functionality:

    curl -T Test.txt -u user:password ftp://ftp.MyFTP.com/uploadTest

    I've been going round in circles looking at the mass of Unix-like stuff
    in the libcurl package, but can't find an 'in' point to get it running
    on OSX.

    Any advice greatly appreciated.

    Thanks

    Steve

    Steve Guest

  2. #2

    Default Re: Any OSX libcurl experts?

    In article <bq7jv2$4jn$btinternet.com>,
    Steve James <com> wrote:
     

    #include <cerrno>
    #include <iostream>
    #include <cstdio>

    #include <Carbon.h>

    using std::cout;
    using std::endl;

    const int k_cbBUFF = 1024;

    int main(void)
    {
    cout << "Hello World!" << endl;

    int err = 0;
    FILE* fh = NULL;
    fflush(0);
    fh = popen("curl -O ftp://ftp.MyFTP.com/uploadTest 2>&1", "r");
    if(fh) {
    char chBuff[k_cbBUFF];

    while(fgets(chBuff, k_cbBUFF, fh)) {
    cout << chBuff << endl;
    }

    err = pclose(fh);
    }

    return 0;
    }
    lloyd Guest

  3. #3

    Default Re: Any OSX libcurl experts?

    In article <bq7jv2$4jn$btinternet.com>,
    Steve James <com> wrote:
     

    I'm not an expert as such, but I have done it. I use libcurl in my
    current application. Fantastic library, not too hard to get into... if
    you've done similar things before.

    If you've got fink, install curl, or curl-ssl if you want the secure
    transport stuff (for HTTPS for example). If that doesn't install the
    libraries (libcurl), you'll probably need curl-dev and curl-shlibs (or
    curl-ssl-dev and curl-ssl-shlibs).

    If you dont have fink, I'd suggest using their package anyway:
    <http://fink.sourceforge.net/pdb/package.php/curl-ssl>

    Once you've got it installed, the instuctions here:
    <http://curl.haxx.se/libcurl/using/>
    really are quite good. Let us know when you get stuck.

    --
    Heath
    __________________________________________________ ______
    | *Nothing is foolproof to a sufficiently talented fool* |
    | _\|/_ |
    |________________________________________m(. .)m_________|
    Heath Guest

  4. #4

    Default Re: Any OSX libcurl experts?

    Thanks, but can you tell me what headers and libs to use to get popen
    and pclose to be recognised?

    Steve

    lloyd wrote: 
    >
    >
    > #include <cerrno>
    > #include <iostream>
    > #include <cstdio>
    >
    > #include <Carbon.h>
    >
    > using std::cout;
    > using std::endl;
    >
    > const int k_cbBUFF = 1024;
    >
    > int main(void)
    > {
    > cout << "Hello World!" << endl;
    >
    > int err = 0;
    > FILE* fh = NULL;
    > fflush(0);
    > fh = popen("curl -O ftp://ftp.MyFTP.com/uploadTest 2>&1", "r");
    > if(fh) {
    > char chBuff[k_cbBUFF];
    >
    > while(fgets(chBuff, k_cbBUFF, fh)) {
    > cout << chBuff << endl;
    > }
    >
    > err = pclose(fh);
    > }
    >
    > return 0;
    > }[/ref]

    Steve Guest

  5. #5

    Default Re: Any OSX libcurl experts?

    OK thanks, I have it installed now and have added the libcurl.a library
    to my CW project along with:
    #include <curl.h>
    #include <easy.h>

    But I fall at the first hurdle! The docs say you must begin with

    curl_global_init()

    which does not seem to appear in any of the headers, so I get an
    'undefined identifier' error.
     

    Maybe if you're a unix user. Otherwise, no mention of includes of
    libraries, and how to set them for a non-unix IDE.

    many thanks

    Steve



    Heath Raftery wrote:
     
    >
    >
    > I'm not an expert as such, but I have done it. I use libcurl in my
    > current application. Fantastic library, not too hard to get into... if
    > you've done similar things before.
    >
    > If you've got fink, install curl, or curl-ssl if you want the secure
    > transport stuff (for HTTPS for example). If that doesn't install the
    > libraries (libcurl), you'll probably need curl-dev and curl-shlibs (or
    > curl-ssl-dev and curl-ssl-shlibs).
    >
    > If you dont have fink, I'd suggest using their package anyway:
    > <http://fink.sourceforge.net/pdb/package.php/curl-ssl>
    >
    > Once you've got it installed, the instuctions here:
    > <http://curl.haxx.se/libcurl/using/>
    > really are quite good. Let us know when you get stuck.
    >[/ref]

    Steve Guest

  6. #6

    Default Re: Any OSX libcurl experts?

    On Sat, 29 Nov 2003, Steve James wrote:
     

    stdio.h (although i expect that you will need to be using the BSD C
    library rather than MSL for this to actually work)

    Fred
     
    > >
    > >
    > > #include <cerrno>
    > > #include <iostream>
    > > #include <cstdio>
    > >
    > > #include <Carbon.h>
    > >
    > > using std::cout;
    > > using std::endl;
    > >
    > > const int k_cbBUFF = 1024;
    > >
    > > int main(void)
    > > {
    > > cout << "Hello World!" << endl;
    > >
    > > int err = 0;
    > > FILE* fh = NULL;
    > > fflush(0);
    > > fh = popen("curl -O ftp://ftp.MyFTP.com/uploadTest 2>&1", "r");
    > > if(fh) {
    > > char chBuff[k_cbBUFF];
    > >
    > > while(fgets(chBuff, k_cbBUFF, fh)) {
    > > cout << chBuff << endl;
    > > }
    > >
    > > err = pclose(fh);
    > > }
    > >
    > > return 0;
    > > }[/ref]
    >
    >[/ref]

    Frederick Guest

  7. #7

    Default Re: Any OSX libcurl experts?

    On Sat, 29 Nov 2003, Steve James wrote:
     

    That function was only added in libcurl 7.8, the version of libcurl that
    comes with 10.2.8 is only 7.7.2, so you do not need to call this function
    (10.3 comes with 7.10.2 and thus its header files define curl_global_init)

    Fred

     
    >
    > Maybe if you're a unix user. Otherwise, no mention of includes of
    > libraries, and how to set them for a non-unix IDE.
    >
    > many thanks
    >
    > Steve
    >
    >
    >
    > Heath Raftery wrote:

    > >
    > >
    > > I'm not an expert as such, but I have done it. I use libcurl in my
    > > current application. Fantastic library, not too hard to get into... if
    > > you've done similar things before.
    > >
    > > If you've got fink, install curl, or curl-ssl if you want the secure
    > > transport stuff (for HTTPS for example). If that doesn't install the
    > > libraries (libcurl), you'll probably need curl-dev and curl-shlibs (or
    > > curl-ssl-dev and curl-ssl-shlibs).
    > >
    > > If you dont have fink, I'd suggest using their package anyway:
    > > <http://fink.sourceforge.net/pdb/package.php/curl-ssl>
    > >
    > > Once you've got it installed, the instuctions here:
    > > <http://curl.haxx.se/libcurl/using/>
    > > really are quite good. Let us know when you get stuck.
    > >[/ref]
    >
    >[/ref]

    Frederick Guest

  8. #8

    Default Re: Any OSX libcurl experts?

    In article <bqagm1$9v3$btinternet.com>,
    Steve James <com> wrote:
     

    Open Terminal and type 'man popen', or alternatively use the "Open man
    page..." item under the Xcode Help menu. You'll see that you need to
    #include <stdio.h> and link against libc.
    Michael Guest

Similar Threads

  1. libcurl on Windows boxes ?
    By tomazi75@gmail.com in forum PERL Modules
    Replies: 21
    Last Post: July 12th, 01:25 PM
  2. #25774 [Opn->Bgs]: Problems with libcurl + kerberos
    By sniper@php.net in forum PHP Development
    Replies: 0
    Last Post: October 8th, 10:52 AM
  3. #25774 [Fbk->Opn]: Problems with libcurl + kerberos
    By maido at net-style dot it in forum PHP Development
    Replies: 1
    Last Post: October 8th, 10:03 AM
  4. #25774 [Opn->Fbk]: Problems with libcurl + kerberos
    By sniper@php.net in forum PHP Development
    Replies: 1
    Last Post: October 7th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139