How to include hbCurl?
How to include hbCurl?
Hello friends,
How to include hbCurl? Is it working in xHarbour, too?
Best regards,
Otto
How to include hbCurl? Is it working in xHarbour, too?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: How to include hbCurl?
Otto,
I include, in a .mak file, the following:
echo $(HBDIR)\lib\hbtipssl.lib >> msvc.tmp
echo $(HBDIR)\lib\hbcurl.lib >> msvc.tmp
echo $(HBDIR)\lib\libcurl.lib >> msvc.tmp
I do my builds with Harbor and MSVC
It works fine. Also include the libcurl.dll
It also works for 64 bit with those libraries and the 64 bit dll
Tim
I include, in a .mak file, the following:
echo $(HBDIR)\lib\hbtipssl.lib >> msvc.tmp
echo $(HBDIR)\lib\hbcurl.lib >> msvc.tmp
echo $(HBDIR)\lib\libcurl.lib >> msvc.tmp
I do my builds with Harbor and MSVC
It works fine. Also include the libcurl.dll
It also works for 64 bit with those libraries and the 64 bit dll
Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Re: How to include hbCurl?
Hello Tim,
thank you for your help.
While I was looking for a solution yesterday to make cUrl common in my desktop program, I then tried a solution with the command prompt and shellExecute. That works well.
What are the disadvantages of shellExec()? I have been using 7Zip in this way for years.
On the whole, the path with shellExEc() would seem more maintenance-friendly to me if you would otherwise have no issues or only have to deal with the firewall during the initial setup.
Best regards,
Otto
thank you for your help.
While I was looking for a solution yesterday to make cUrl common in my desktop program, I then tried a solution with the command prompt and shellExecute. That works well.
What are the disadvantages of shellExec()? I have been using 7Zip in this way for years.
On the whole, the path with shellExEc() would seem more maintenance-friendly to me if you would otherwise have no issues or only have to deal with the firewall during the initial setup.
Best regards,
Otto
Code: Select all | Expand
c:\curl-8.6.0_3-win64-mingw\bin\curl.exe -u username:password -k -F "fileToUpload=@c:\xxxx\tmpplan\planangebot.dbf" https://test.com/webservices/responderdbf.php
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to include hbCurl?
Dear Otto,
> What are the disadvantages of shellExec()?
I guess the only problem is that the user does not have curl.exe installed or at the right path
> What are the disadvantages of shellExec()?
I guess the only problem is that the user does not have curl.exe installed or at the right path
- Enrico Maria Giordano
- Posts: 8728
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: How to include hbCurl?
Hi Otto,Otto wrote:Hello friends,
How to include hbCurl? Is it working in xHarbour, too?
Best regards,
Otto
Yes, it is working with xHarbour too. You have to link hbcurl.lib and libcurl.lib. Then you must have libcurl.dll in the same folder of the EXE (or in the path, of course).
Re: How to include hbCurl?
HI,
you can generate C code from the CURL command line
adding "--libcurl filename.c" to the end of the command line
below is an example:
curl http://example.com --libcurl example.c
look at the link
https://everything.curl.dev/libcurl/libcurl
you can generate C code from the CURL command line
adding "--libcurl filename.c" to the end of the command line
below is an example:
curl http://example.com --libcurl example.c
look at the link
https://everything.curl.dev/libcurl/libcurl
Re: How to include hbCurl?
Hello friends,
Thank you for your help.
I have now solved it with the command prompt Exe.
On this occasion, I started creating the setup program with webview2 and fivewin.
Fortunately, I had already made a patcher and preprocessor before ChatGPT.
Now, this is a very functional way to simplify the programs. Through modularization, one can have ChatGPT further develop parts of the program very effectively. This makes program creation very fast.
Best regards,
Otto
Thank you for your help.
I have now solved it with the command prompt Exe.
On this occasion, I started creating the setup program with webview2 and fivewin.
Fortunately, I had already made a patcher and preprocessor before ChatGPT.
Now, this is a very functional way to simplify the programs. Through modularization, one can have ChatGPT further develop parts of the program very effectively. This makes program creation very fast.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Marc Venken
- Posts: 1481
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: How to include hbCurl?
Tim,TimStone wrote:Otto,
I include, in a .mak file, the following:
echo $(HBDIR)\lib\hbtipssl.lib >> msvc.tmp
echo $(HBDIR)\lib\hbcurl.lib >> msvc.tmp
echo $(HBDIR)\lib\libcurl.lib >> msvc.tmp
I do my builds with Harbor and MSVC
It works fine. Also include the libcurl.dll
It also works for 64 bit with those libraries and the 64 bit dll
Tim
Are you using cUrl for reading API's ? By any change the API from Mailchimp ?
curl -sS "https://us8.api.mailchimp.com/3.0/ping" --user "anystring:cApi"
I want to read the result from this command insite FW. and give the command also from FW
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: How to include hbCurl?
Marc, you can redirect to a file: clogrooms and then read with memoread.
Regards,
Otto
DCOM := 'cmd /c "' +;
cCurlPath + 'curl.exe -u username:password -i -k -F "fileToUpload=@' +;
aSrc + '" -F "uploadDirectory=' + cuploadDirectory + '" ' +;
cEndpointRooms + ' > ' +;
clogrooms + '"'
WAITRUN( DCOM, 0)
Regards,
Otto
DCOM := 'cmd /c "' +;
cCurlPath + 'curl.exe -u username:password -i -k -F "fileToUpload=@' +;
aSrc + '" -F "uploadDirectory=' + cuploadDirectory + '" ' +;
cEndpointRooms + ' > ' +;
clogrooms + '"'
WAITRUN( DCOM, 0)
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Marc Venken
- Posts: 1481
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: How to include hbCurl?
Otto, Thanks for the sample.
I got it working now to read with cUrl...
Now digging into the hard part of getting all elements
I got it working now to read with cUrl...
Now digging into the hard part of getting all elements
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
- Marc Venken
- Posts: 1481
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: How to include hbCurl?
I can read several data with the API, but struggle with the one that can change a TAG (like a groupname) into Mailchimp.
This is working, and I get the tags from a email
DCOM := 'cmd /c curl -sS https://us8.api.mailchimp.com/3.0/lists ... ail+'/tags --user anystring:'+cApi+' > clogrooms.txt'
In order to add a Tag this should be executed, but I allways fale in passing the correct data
This is NOT working
DCOM := 'cmd /c curl -sS https://us8.api.mailchimp.com/3.0/lists ... '/members/';
+cSecure_Email+'/tags --user anystring:';
+cApi+'-d tags:'+aTags+',is_syncing:false';
+' > clogrooms.txt'
and Mailchimp api says :
curl -X POST \
https://${dc}.api.mailchimp.com/3.0/lists/{list_id}/members/{subscriber_hash}/tags \
--user "anystring:${apikey}"' \
-d '{"tags":[],"is_syncing":false}'
By any change that somebody knows how to do it ?
This is working, and I get the tags from a email
DCOM := 'cmd /c curl -sS https://us8.api.mailchimp.com/3.0/lists ... ail+'/tags --user anystring:'+cApi+' > clogrooms.txt'
In order to add a Tag this should be executed, but I allways fale in passing the correct data
This is NOT working
DCOM := 'cmd /c curl -sS https://us8.api.mailchimp.com/3.0/lists ... '/members/';
+cSecure_Email+'/tags --user anystring:';
+cApi+'-d tags:'+aTags+',is_syncing:false';
+' > clogrooms.txt'
and Mailchimp api says :
curl -X POST \
https://${dc}.api.mailchimp.com/3.0/lists/{list_id}/members/{subscriber_hash}/tags \
--user "anystring:${apikey}"' \
-d '{"tags":[],"is_syncing":false}'
By any change that somebody knows how to do it ?
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: How to include hbCurl?
Marc, have yout tried the answer ChatGPT gives you?
Best regards,
Otto
Best regards,
Otto
It seems like you're trying to add tags to a member in a MailChimp list using the MailChimp API and curl in a command line environment. The issue appears to be with the way you're formatting the JSON data in your curl command. Let's break down the correct format and structure for your curl command to add tags to a member.
Here's the general format you need to follow based on Mailchimp's documentation:
```bash
curl -X POST \
https://${dc}.api.mailchimp.com/3.0/lists/{list_id}/members/{subscriber_hash}/tags \
--user "anystring:${apikey}" \
-d '{"tags": [{"name": "tagName", "status": "active"}], "is_syncing": false}'
```
Now, applying this format to your specific case, the command should look something like this:
```bash
DCOM := 'cmd /c curl -X POST https://us8.api.mailchimp.com/3.0/lists/' + cListID + '/members/' + cSecure_Email + '/tags --user "anystring:' + cApi + '" -d "{""tags"": [{""name"": ""' + aTags + '"", ""status"": ""active""}], ""is_syncing"": false}" > clogrooms.txt'
```
In this command, `cListID` should be replaced with your MailChimp list ID, `cSecure_Email` should be the subscriber's hashed email address, `cApi` is your API key, and `aTags` is the tag name you want to add. Note that we need to escape double quotes inside the JSON data by using `""`.
Make sure that `aTags` is properly formatted. If `aTags` is a variable containing the tag name, ensure that it doesn't have spaces or special characters that might break the JSON format.
If you have multiple tags to add, you would expand the `tags` array like so:
```json
"tags": [{"name": "tagName1", "status": "active"}, {"name": "tagName2", "status": "active"}]
```
Lastly, ensure that the email address is correctly hashed as per Mailchimp's requirements (using MD5 and in lowercase) when replacing `cSecure_Email`. If there are still issues, double-check the JSON payload for correct formatting and ensure that all required fields are provided accurately.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Marc Venken
- Posts: 1481
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: How to include hbCurl?
I went in conversation with ChatGPT )))) I have to say... that guy has patience
But we didn't get the solution.
Last try was this :
Your request doesn't appear to be valid JSON:
Parse error on line 1:
tags: { name: tag1,
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
But we didn't get the solution.
Last try was this :
Code: Select all | Expand
*** Hard coded test tag)
cTagName := "tag1" // De naam van de tag
cTagStatus := "active" // De status van de tag
*** Constructie JSON-payload met de enkele tag
cJsonPayload := '"tags": { "name": "' + cTagName + '", "status": "' + cTagStatus + '" } , "is_syncing": false '
msginfo(cJsonPayload)
DCOM := 'cmd /c curl -sS https://us8.api.mailchimp.com/3.0/lists/' + cLists + '/members/' + cSecure_Email + '/tags --user anystring:' + cApi + ' -d ' + CHR(34) + cJsonPayload + CHR(34) + ' > clogrooms.txt'
Parse error on line 1:
tags: { name: tag1,
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: How to include hbCurl?
Marc,
I think you need
tags: { name: "tag1",
Best regards,
Otto
Not tested:
I think you need
tags: { name: "tag1",
Best regards,
Otto
Not tested:
Code: Select all | Expand
cresponse := "["
cresponse += "{" + '"name":' + '"' + 'name default' + '",'
cresponse += '"CurlPath":' + '"' + h['CurlPath'] + '",'
cresponse += '"test":' + '"' + 'test' + '" },'
cresponse := left( cresponse , len( cresponse )-1 ) + "]"
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************