Some applications built with ExeOutput for PHP function as custom browsers for navigating websites. You can add custom headers to HTTP requests, allowing you to identify the user by passing a browser/machine ID and take appropriate actions.
Note
Headers are name/value pairs that appear in both request and response messages. The header name is separated from its value by a single colon.
Insert the following HEScript code into your UserMain script (see how to do this) to create a custom HTTP header. Modify the My Header Name and My Header Value fields as needed.
procedure OnStartMainWindow;
begin
// When the main window is going to be displayed (just before the homepage is shown).
SetUIProp("crm", "CustomHeaderName", """My Header Name""");
SetUIProp("crm", "CustomHeaderValue", """My Header Value""");
end;This can be done in the OnStartMainWindow HEScript event.
Warning
In this specific case, the third parameter should use triple double quotes for string values (e.g., """String Value""") and single quotes for functions (to be interpreted by the script engine, e.g., "MD5OfAString(...)").
Tutorial: How to Send a Unique Computer ID to a Remote Server #
Go to the Scripting page and double-click
UserMain.Locate the
OnStartMainWindowevent and replace it with the following code:
procedure OnStartMainWindow;
begin
// When the main window is going to be displayed (just before the homepage is shown).
SetUIProp("crm", "CustomHeaderName", """My-SystemID""");
SetUIProp("crm", "CustomHeaderValue", "MD5OfAString(""MySystemID"" + GetManualHardwareID(2))");
end;GetManualHardwareID is an HEScript function that returns a unique system ID based on hardware specifications. The 2 argument indicates that the unique ID will be based on CPU specifications (e.g., CPU ID). We also generate an MD5 hash sum of the system ID.
Now, when you navigate to any remote URL (e.g., http://www.yoursite.com/...), a custom HTTP header named My-SystemID is added to the request. You can read this header with a PHP script on your remote server. For instance, the following PHP script prints all HTTP request headers:
<?php
foreach (getallheaders() as $name => $value) {
echo "$name: $value\n";
}
?>The following screenshot shows the result of the code above:

As you can see, there is a custom HTTP header named My-SystemID with the appropriate MD5 hash sum.