Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 18:42:49 +0000



Post From: Sending requests to a server

[2018-12-20 22:37:10]
Sierra Chart Engineering - Posts: 104368
You need to wait for release 1853 and this is the code example:

SCSFExport scsf_HTTPTestWithPOST(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "HTTP Request Test with POST";

    sc.StudyDescription = "This is a study function that demonstrates how to request data from a web server.";

    sc.AutoLoop = 0;
    return;
  }

  int& RequestState = sc.GetPersistentInt(1);

  // Do data processing

  if (sc.UpdateStartIndex == 0 && sc.IsFullRecalculation)
  {
    if (RequestState == HTTP_REQUEST_ERROR || RequestState == HTTP_REQUEST_RECEIVED)
    {
      n_ACSIL::s_HTTPHeader HTTPHeader;
      HTTPHeader.Name = "Custom";
      HTTPHeader.Value = "Value";

      // Make a request to the server.
      // When the request is complete and all of the data has been downloaded,
      //this study function will be called with the file placed into the sc.HTTPResponse character string array.
      if (!sc.MakeHTTPPOSTRequest("https://www.sierrachart.com/Test/ACSILPOSTTest.php", "Message=PostData", &HTTPHeader, 1))
      {
        sc.AddMessageToLog("Error making HTTP request.", 1);
      }

      RequestState = HTTP_REQUEST_MADE;
    }
  }

  if (RequestState == HTTP_REQUEST_MADE && sc.HTTPRequestID != 0)
  {
    RequestState = HTTP_REQUEST_RECEIVED;

    // Display the response from the Web server in the Message Log
    sc.AddMessageToLog(sc.HTTPResponse, 1);
  }
}

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-12-20 22:40:25