cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Often error 23

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 18 Dec 2013 00:48:37 +0100

On Tue, Dec 17, 2013 at 01:58:38PM -0600, Marco A. Cruz Quevedo wrote:
> I am using libcurl

Then you should really be using the curl-library mailing list.

> .dll through FoxPro

Although, that list doesn't cover any binding in particular besides the
canonical C one. If there's a separate mailing list for the libcurl
FoxPro binding, you will probably get a better response there.

> but I receive error 23 very often.
> The code is the following:
> ---
> curl_global_init(CURL_GLOBAL_ALL)
> hcurl = curl_easy_init()
> if hcurl>0
>     *-- prepare data
>     post_dat="dd=dummy&"+http_post(@aregistro)
>     *--
>     fh=fcreate("post.dat")
>     fwrite(fh,post_dat)
>     fclose(fh)
>
>     ?"-- valid handle",hcurl
>     curl_easy_setopt(hcurl, CURLOPT_URL, _url)
>     curl_easy_setopt(hcurl, CURLOPT_POSTFIELDS, post_dat)
>     rv = curl_easy_perform(hcurl)
>     if rv=CURLE_OK
>     ?"OK, resultado: ",rv
>     else
>     *-- display error
>         wait window "*** URL_LIB Error:"+str(rv,6,0)
>     endif
>     curl_easy_cleanup(hcurl)
> else
>     ?"*** invalid handle"
> endif
> endfunc
> ---
>
> Documentation indicates:
> CURLE_WRITE_ERROR (23)
>
> An error occurred when writing received data to a local file, or an error was
> returned to libcurl from a write callback.
>
> How do I set a file to receive any output as result of curl_easy_perform()
> function?

If this binding is anything like the C one, and from the snippet you've
posted it looks very close, there will be a CURLOPT_WRITEFUNCTION option
that sets up a callback function that receives writes. Make sure to return
a correct value from that function and this problem should go away.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-12-18