Login Page - Create Account

Support Board

Date/Time: Thu, 07 Jul 2022 16:50:31 +0000

HTTPPOST always returns empty response (confirmed that HTTPResponse from server is non-empty)

View Count: 70

[2022-05-19 13:09:21]
ray42 - Posts: 15

I'm trying to encode a string like
param=123¶m2=abc def¶m3=chart #1
into a valid URL like following:

I did not find any sc.* functions to achieve this so I found a few URL encode methods for C++ (source: https://stackoverflow.com/questions/154536/encode-decode-urls-in-c, https://gist.github.com/litefeel/1197e5c24eb9ec93d771)

But none of these methods work as the printed string is just random characaters.

#include <cctype>
#include <iomanip>
#include <sstream>
#include <string>
string url_encode(const string &value) {
ostringstream escaped;
escaped << hex;

for (string::const_iterator i = value.begin(), n = value.end(); i != n; ++i) {
string::value_type c = (*i);

// Keep alphanumeric and other accepted characters intact
if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
escaped << c;

// Any other characters are percent-encoded
escaped << uppercase;
escaped << '%' << setw(2) << int((unsigned char) c);
escaped << nouppercase;

return escaped.str();

SCSFExport scsf_samplecode(SCStudyInterfaceRef sc){

if (sc.SetDefaults){ ... }

SCString PostMessage = "param=123¶m2=abc def¶m3=chart #1";
sc.AddMessageToLog(PostMessage, 0);

SCString PostMessagEnc;
PostMessagEnc.Format("%s", url_encode(PostMessage.GetChars()));
sc.AddMessageToLog(PostMessagEnc, 0);


Can someone please help with a solution for this?

Edit: Please ignore this - I have found a solution based on another thread and have posted it as a comment, but I'm not able to see HTTP responses.
Date Time Of Last Edit: 2022-05-19 15:34:38
image2022-05-19 18_36_33-Message Log.png / V - Attached On 2022-05-19 13:07:40 UTC - Size: 2.24 KB - 12 views
[2022-05-19 15:33:01]
ray42 - Posts: 15
Solved by using `sc.MakeHTTPPOSTRequest` and handling the post data string in the backend appropriately.

This thread helped: https://www.sierrachart.com/SupportBoard.php?ThreadID=58501

However, I'm still not able to see the response from the server.

Engineering Team, can you please help with this?

Also, saw this thread: https://www.sierrachart.com/SupportBoard.php?ThreadID=49319

I tried printing out the HTTPResponse in other parts of the code, still, I'm not able to see anything on the output log.

To post a message in this thread, you need to log in with your Sierra Chart account:


Login Page - Create Account