EA Activator Communication Issue – WebRequest returns -1, GetLastError: 4029
#property strict
void OnStart()
{
// Define the URL
string url = "http://www.worldtimeserver.com/";
// Arrays for storing the response and response headers
char result[4096];
char result_headers[4096];
string headers;
// Set the timeout in milliseconds
int timeout = 5000;
// Send a GET request to the URL
int res = WebRequest("GET", url, "", timeout, result, result_headers, headers);
int err = GetLastError();
Print("WebRequest result: ", res, ", GetLastError: ", err);
if(res != 200)
{
Print("WebRequest failed. Check that the URL is added to the allowed list (Tools → Options → Expert Advisors), run MT5 as administrator, and ensure it's not blocked by the firewall/antivirus.");
}
else
{
string response = CharArrayToString(result);
Print("WebRequest succeeded. Response: ", response);
Print("Response headers: ", headers);
}
}
}
Hello everyone,
I'm experiencing an issue with the activator in my EA. The EA is supposed to validate a license key by contacting a verification page using the WebRequest function. Although the EA appears to connect to the page, I never receive any response. In the Experts log, I see the following error:
Hello everyone,
I am experiencing an issue with my EA activator. The EA is designed to validate a license key by contacting a verification page, but it never receives any response from the server. In the Experts log, I see an error stating:
"License check failed. Error code: -1, GetLastError: 4029"
Here’s what I have done so far:
-
I verified that my PHP script works correctly by accessing it directly in a web browser (for example, http://127.0.0.1:80/license_check.php?license=TESTKEY returns the expected JSON response, such as {"status":"OK"}).
-
I added the exact URL (including port) to the Allowed URLs in MT4’s Expert Advisors settings (both http://127.0.0.1:80 and http://localhost:80).
-
I have run MetaTrader as an administrator and temporarily disabled my firewall/antivirus software.
-
I also tested using a public URL (like http://neverssl.com/) that should not trigger SSL redirection issues, but the error persists with GetLastError: 4029.
It appears that the EA is unable to receive any data from the server. Has anyone encountered a similar issue or can suggest further troubleshooting steps?
Thank you for your help!
I'd suggest not to use fixed-size arrays, all receiving arrays should be dynamic and resizable:
char result[]; char result_headers[];
Hello everyone,
I'm experiencing an issue with the activator in my EA. The EA is supposed to validate a license key by contacting a verification page using the WebRequest function. Although the EA appears to connect to the page, I never receive any response. In the Experts log, I see the following error:
Hello everyone,
I am experiencing an issue with my EA activator. The EA is designed to validate a license key by contacting a verification page, but it never receives any response from the server. In the Experts log, I see an error stating:
"License check failed. Error code: -1, GetLastError: 4029"
Here’s what I have done so far:
I verified that my PHP script works correctly by accessing it directly in a web browser (for example, http://127.0.0.1:80/license_check.php?license=TESTKEY returns the expected JSON response, such as {"status":"OK"}).
I added the exact URL (including port) to the Allowed URLs in MT4’s Expert Advisors settings (both http://127.0.0.1:80 and http://localhost:80).
I have run MetaTrader as an administrator and temporarily disabled my firewall/antivirus software.
I also tested using a public URL (like http://neverssl.com/) that should not trigger SSL redirection issues, but the error persists with GetLastError: 4029.
It appears that the EA is unable to receive any data from the server. Has anyone encountered a similar issue or can suggest further troubleshooting steps?
Thank you for your help!