wininet

Download URL Contents Directly into String (VB6) WITHOUT Saving to Disk

末鹿安然 提交于 2019-12-10 10:02:05
问题 Basically, I want to download the contents of a particular URL (basically, just HTML codes in the form of a String) into my VB6 String variable. However, there are some conditions. I know about the URLDownloadToFile Function - however, this requires that you save the downloaded file/HTML onto a file location on disk before you can read it into a String variable, this is not an option for me and I do not want to do this. The other thing is, if I need to use an external library, it must already

How i can retrieve the error description for a WinInet error code from delphi

会有一股神秘感。 提交于 2019-12-09 16:59:26
问题 I need to obtain the description of an WinInet function error code, The MSDN documentation about the WinInet functions says which I must use the GetLastError function to retrieve the last error code when a functions fails. Now when I check the documentation about the GetLastError function says . .To obtain an error string for system error codes, use the FormatMessage function I check which the SysErrorMessage delphi function internally calls the FormatMessage winapi function, so i am using

Connecting to Internet?

江枫思渺然 提交于 2019-12-08 13:57:46
问题 I'm having issues with connecting to the Internet using python. I am on a corporate network that uses a PAC file to set proxies. Now this would be fine if I could find and parse the PAC to get what I need but I cannot. The oddity: R can connect to the internet to download files through wininet and .External(C_download,...) so I know it is possible and when I do: import ctypes wininet = ctypes.windll.wininet flags = ctypes.wintypes.DWORD() connected = wininet.InternetGetConnectedState(ctypes

WinINet InternetGetProxyInfo : error 1003 ERROR_CAN_NOT_COMPLETE

烈酒焚心 提交于 2019-12-08 09:31:30
问题 I'm trying to make an application compatible with the auto proxy API provided by the WinINet library in order to make local pac files work, and am stuck with the error ERROR_CAN_NOT_COMPLETE when trying to call InternetGetProxyInfo ... I have been following the post of Eric Loewenthal (dev @Microsoft so I hope his suggestion are A-OK ;p) in here and the idea should be: Call the InternetInitializeAutoProxyDll function; Call the InternetGetProxyInfo to get the proxy URL for each given requested

What initialization should be made prior to calling InternetGetProxyInfo()?

大兔子大兔子 提交于 2019-12-08 07:46:50
问题 I configured internet explorer to use a local PAC file: It works just fine. But when I try to call InternetGetProxyInfo() , it fails with ERROR_CAN_NOT_COMPLETE . What can be the problem? #ifndef WINVER // Allow use of features specific to Windows XP or later. #define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the

Trying to get socket from wininet HTTP connection

拟墨画扇 提交于 2019-12-08 05:15:59
问题 We have a legacy application that implements an SSL tunnel over Web proxies. It uses the wininet API and it worked fine for years on XP, but now it fails on Windows 7. I've tried to isolate the code and made a small program to reproduce the problem. It's a small C program compiled with MSVC 9. See below. On Windows 7, once connected to the proxy (status code 200), I just cannot get the socket descriptor from the API. All I get is an INVALID_SOCKET, even though all wininet functions returned

InternetSetCookie does not store cookie in Temporary Internet Files

孤人 提交于 2019-12-08 04:50:46
问题 I'm trying to create a cookie on client side using wininet from a c# winform application. So I use this code: [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool InternetSetCookie ( string lpszUrlName, string lbszCookieName, string lpszCookieData ); private void btnRestaure_Click(object sender, EventArgs e) { try { var result = InternetSetCookie("www.mydomain.com", "MyCookie", "value=helloworld"); } catch(Exception ex) { } } InternetSetCookie

Wininet SSL client authenticate oddness

那年仲夏 提交于 2019-12-08 04:41:25
问题 I have a crawler that for HTTPs switches over to Wininet. This usually works well, but for a website I get error ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED Example code: vErrorNone := HttpSendRequest(HttpOpen_Request, nil, 0, nil, 0); if vErrorNone = False then begin vErrorID := GetLastError; if (vErrorID = ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED) then begin // this error end ; end ; I then tried an experiment with: TmpFakePointer := nil; vErrorNone := InternetErrorDlg( GetDesktopWindow() ,

Delphi Download File with WinInet with UserName and Password

你。 提交于 2019-12-08 04:14:17
问题 There are numerous articles of how to download a file using WinInet (that's where I got the code from), but they all seem to be older and/or closed. Downloading without a username and password works fine, but if I protect the folder (Using VodaHost) with username and password I keep getting an authentication error when trying to download a file: 401 Unauthorized...... If I access through a web browser the username/password dialog pops up and I can get in fine. The folder protected is: http:/

How can I download a huge file via TIdHTTP?

ぃ、小莉子 提交于 2019-12-06 08:58:00
问题 I use this code to download small files: Var ms:TMemoryStream; begin ms:=TMemoryStream.Create; Idhttp1.get('http://mydomain.com/myfile.zip',ms); ms.SaveToFile('myfile.zip'); ms.Free; end; But file is saved in RAM before storing to disk, so it may be difficult to download files >1Gb, for example. Is there a way to download a file by its parts? Or do I need to use the WinInet? Thanks in advance! 回答1: TMemoryStream provides an in-memory buffer, so if you download into one, you need to have