Optoscript httpget with user:password (PAC R1/PacControl)

You may need to add an authorization header to your stHttpHeader table.

See Base64 encoding/decoding sample code for a subroutine to perform the needed base64 encoding.

Here is an example from one of my projects:

sLogBuildString = sLogUser + ":" + sLogPassword;

Base64EncodeDecode(sLogBuildString, sLogBuildString, 1, nJunkStatus );

stHttpRequestHeaderLog[0] = "Host: " + sHttpHostNameLog;
stHttpRequestHeaderLog[1] = "User-Agent: Opto22 PAC";
stHttpRequestHeaderLog[2] = "Authorization: Basic " + sLogBuildString;
stHttpRequestHeaderLog[3] = "Cache-Control: no-cache";
1 Like