Page 8 of 9

Re: libcurl.pbi

Posted: Wed Oct 30, 2024 1:17 pm
by flashbob
... of course it's just a simple example ;-)

When I look at the commands regarding POP3 (see also links below), libcurl's functionality seems to be limited here. According to my research so far, even in C/C++ there is no example for retrieving all emails at once without logging into the server for each mail.

Even Stenberg's manual does not provide any useful information here.

After you maintain this topic, you might have a tip for an example in C, C++, PHP or a corresponding link ?


https://everything.curl.dev/usingcurl/reademail.html
https://curl.se/libcurl/c/example.html
https://github.com/curl/curl/tree/master/docs/examples

Re: libcurl.pbi

Posted: Wed Oct 30, 2024 2:21 pm
by infratec
I only provide the access to the libcurl commands.

But ...

you can do multiple curl_easy_perform() after an other.
login should be only done once.

So first get the list of ids, then do a loop with

Code: Select all

ForEach IndexList()
 curl_easy_setopt(curl, #CURLOPT_URL, "pop3://pop.example.com/" + str(IndexList()))
 curl_easy_perform()
 ...
Next

Re: libcurl.pbi

Posted: Wed Oct 30, 2024 3:12 pm
by flashbob
Thanks for the info.

Your example shows normal usage of curl_easy. This works for me too (runs in its own thread).
The Problem: Every time you receive a message, a new login is performed (see code below).

Code: Select all

curl = curl_easy_init()
If curl
  ; Set username and password
  curl_easy_setopt_str(curl, #CURLOPT_USERNAME, User$)                            ; **** Login (every time in loop)
  curl_easy_setopt_str(curl, #CURLOPT_PASSWORD, Password$)               
  curl_easy_setopt_str(curl, #CURLOPT_URL, Url$ + "/" + Str(MsgNum))
  ...
  res = curl_easy_perform(curl)
  If res = #CURLE_OK
    ...
  endif
  curl_easy_cleanup(curl)
endif  
My idea was to log into the server once and then retrieve all emails without having to re-authenticate.
I think when using curl_easy there is no other way to bypass the repeated login...

Re: libcurl.pbi

Posted: Wed Oct 30, 2024 4:05 pm
by infratec
I see no loop in your code.

The loop needs to be inside your If curl after your settings.

Look in my code snippet above.

Re: libcurl.pbi

Posted: Wed Oct 30, 2024 8:36 pm
by flashbob
That is clear. This shouldn't be the complete code with loop, but just show that a login is required every time you use curl_easy...

but thanks for the info...

Re: libcurl.pbi

Posted: Wed Oct 30, 2024 10:59 pm
by HeX0R
I don't want to hijack this thread, but maybe this is an alternative:
viewtopic.php?t=51959

Re: libcurl.pbi

Posted: Thu Oct 31, 2024 4:20 pm
by flashbob
Hi HeXOR,
thanks for the information, I know the thread and your code works really fine on windows - good stuff!

I used libcurl because my application runs on Windows and MAC and I didn't find the necessary libs for libTLS for MAC ;-)
Furthermore libcurl is part of macOS... and I didn't want to compile the libs myself ;-)

So at the moment my program (Pop3) is running fine under Windows/Mac, but from my point of view the performance of
libcurl (curl_easy function) has potential for improvement. That's why I asked here if there is another way for (faster) retrieval of emails.

Maybe I find a corresponding example under C or PHP that I can adapt.

Re: libcurl.pbi

Posted: Tue Nov 19, 2024 8:28 am
by infratec
libcurl dlls updated to 8.11.0

Re: libcurl.pbi

Posted: Sun Dec 01, 2024 9:37 pm
by le_magn
Hi Infratec, could you show me an example of how to monitor the progress of a file download? thanks

Re: libcurl.pbi

Posted: Mon Dec 02, 2024 10:31 pm
by infratec
Added DownloadProgress.pb

You can use PostEvents to update a main program.

Re: libcurl.pbi

Posted: Mon Dec 02, 2024 10:33 pm
by le_magn
infratec wrote: Mon Dec 02, 2024 10:31 pm Added DownloadProgress.pb

You can use PostEvents to update a main program.
thank you very much :)

Re: libcurl.pbi

Posted: Mon Dec 02, 2024 11:11 pm
by infratec
Modified DownloadProgress.pb to show it with a ProgressBarGadget()

Re: libcurl.pbi

Posted: Sat Dec 14, 2024 3:31 pm
by infratec
Added an example:

FTPS_rename.pb

Re: libcurl.pbi

Posted: Sun Dec 22, 2024 2:53 pm
by infratec
libcurl dlls updated to 8.11.1

Re: libcurl.pbi

Posted: Fri Jan 10, 2025 11:00 pm
by infratec
Added HTTP_gzip.pb

To show how a content can be downloaded witz gzip compression to reduce transmission data size.

Since the internal libcurl can not handle the compression, the external libcurl.dll is needed beside the executable.