Hi all,
I am still using VFP 7.0 on our legacy application. I have an update where I need to call a URL and check the result which will either be OK or ERROR. I do not want any UI as a result of this URL call.
I began this task by using a utility written by Drew Speedie that was copied from or based on a FoxPro Advisor article by Rick back in March 1998. That utility essentially calls ShellExecute(). The issue with this method is that I don't want to launch a browser that is visible to the user which this method is doing. I only want to pass the URL and then check the result with no UI.
I then tried to use Rick's example of using WINHTTP.prg which works just wonderfully at the command window, exactly as I need. I pass the URL and I get the result back in a variable that I can check.
However, when I compile the WINHTTP.prg into my .EXE file, I get an error on the following line of code:
loHttp.Send()
I can't figure out why this happens in the .EXE but not at the command window.
Is there a better way to accomplish what I am trying to do?
Thank you in advance for any advice you may have to offer.

... and the error is?
+++ Rick ---
Ricky,
Thanks for your reply! Yeah the error message might help!
This is the error that I am getting in the .EXE:
OLE IDispatch exception code 0 from WinHttp.WinHttpRequest: The host name in the certificate is invalid or does not match
Thanks, Ed
Bad certificate on the server most likely... you'll have to get the certificate fixed.
+++ Rick ---
Rick,
Thanks again for your reply! Based on your last reply, I tried a test call to the URL on our production server instead of our development server and the error did not occur.
I didn't know what could have been causing the error as it worked from a VFP command window on the same machine that the .EXE errors on.
Thanks again for your help!

Is it an older version of Windows? You might be running into TLS 1.2 requirements that don't work on old versions of Windows (or not without tweaking settings).
More info here:
Applies to non-Web Connection stuff as well.
+++ Rick ---
The Dev machine is running Windows 10 Pro.
Don't know then...
Certainly seems base on the error there's some issue with the certificate and the SSL connection. Make sure you're using the correct domain name and not an IP address or localhost or alias. Certificate and domain used have to match exactly.
+++ Rick ---