Theos PowerBasic Museum 2017

Webmaster: José Roca (PBWIN 10+/PBCC 6+) (SDK Forum) => Discussion => Topic started by: Jim Dunn on September 13, 2013, 04:27:10 PM

Title: Request for libcurl header conversion
Post by: Jim Dunn on September 13, 2013, 04:27:10 PM
Hey José,

I hope you won't mind... but I'd like to request a libcurl header conversion from C++ to PowerBASIC... if you have some time??

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

I might be able to make a donation, if that would help encourage you??

Let me know!  : )
Title: Re: Request for libcurl header conversion
Post by: José Roca on September 13, 2013, 09:34:27 PM
Sorry, but I never have been interested in that library. With Windows you can use IXMLHTTPRequest and/or WinInet.
Title: Re: Request for libcurl header conversion
Post by: Jim Dunn on September 14, 2013, 03:39:46 AM
I was looking for a working FTPeS (Explicit FTP) library (or code)...
Title: Re: Request for libcurl header conversion
Post by: Charles Pegge on September 14, 2013, 12:13:19 PM
Hi Jim,

John asked me to post this link for you :)

http://www.allbasic.info/forum/index.php?topic=232.msg2566#msg2566
Title: Re: Request for libcurl header conversion
Post by: Jim Dunn on September 18, 2013, 03:01:16 AM
I went to the Script Basic link... actually went over to the download link... but was unable to figure out the latest version or how to install...

Oh well, no problem... I found this nifty FreeBasic libcurl code (and the libcurl gets compiled into the exe, no need for dll):

   '' FreeBasic Curl HTTP Get example

   #include once "curl.bi"
   #include once "crt/string.bi"

   '' this callback will be called when any data is received
   Private Function write_callback cdecl _
      ( _
         ByVal buffer As Byte Ptr, _
         ByVal size As Integer, _
         ByVal nitems As Integer, _
         ByVal outstream As Any Ptr _
      ) As Integer

      Static As ZString Ptr zstr = 0
      Static As Integer maxbytes = 0

      Dim As Integer bytes = size * nitems

      '' current zstring buffer too small?
      If( maxbytes < bytes ) Then
         zstr = Reallocate( zstr, bytes + 1 )
         maxbytes = bytes
      End If

      '' "buffer" is not null-terminated, so we must dup it and add the null-term
      memcpy( zstr, buffer, bytes )
      zstr[bytes] = 0

      '' just print it..
      Print *zstr

      Return bytes
   End Function

      '' init
      Dim As CURL Ptr curl = curl_easy_init( )
      If( curl = 0 ) Then
         End 1
      End If

      '' set url and callback
      curl_easy_setopt( curl, CURLOPT_URL, "freebasic.net" )
      curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, @write_callback )

      '' execute..
      curl_easy_perform( curl )

      '' shutdown
      curl_easy_cleanup( curl )
Title: Re: Request for libcurl header conversion
Post by: Eros Olmi on September 20, 2013, 05:28:38 AM
http://www.marshallsoft.com/fce4pb.htm
Title: Re: Request for libcurl header conversion
Post by: Raymond Leech on September 20, 2013, 04:46:41 PM
I can highly recommend SocketTools, which includes the different FTP flavors and most of the other common Internet protocols in a PowerBASIC-friendly set of libraries.

https://www.catalyst.com/products/sockettools/library/index.html
Title: Re: Request for libcurl header conversion
Post by: Jim Dunn on September 20, 2013, 05:33:16 PM
Quote from: Eros Olmi on September 20, 2013, 05:28:38 AM
http://www.marshallsoft.com/fce4pb.htm

Doesn't appear that FCE4PB supports FTPS.
Title: Re: Request for libcurl header conversion
Post by: Jim Dunn on September 20, 2013, 05:34:10 PM
Quote from: Raymond Leech on September 20, 2013, 04:46:41 PMI can highly recommend SocketTools, which includes the different FTP flavors and most of the other common Internet protocols in a PowerBASIC-friendly set of libraries.  https://www.catalyst.com/products/sockettools/library/index.html

Thx, I forgot I own v7 of SocketTools... but now I'm really excited about FreeBasic allowing me to include libcurl without an external dll.