winhttprequest

WinHttp doesn't work when hostname doesn't contains www. (error 12029)

核能气质少年 提交于 2019-12-22 14:04:55
问题 I am testing this winhttp example from http://msdn.microsoft.com/en-us/library/aa384270%28v=vs.85%29.aspx DWORD dwSize = 0; DWORD dwDownloaded = 0; LPSTR pszOutBuffer; BOOL bResults = FALSE; HINTERNET hSession = NULL, hConnect = NULL, hRequest = NULL; // Use WinHttpOpen to obtain a session handle. hSession = WinHttpOpen( L"WinHTTP Example/1.0", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0 ); // Specify an HTTP server. if( hSession ) hConnect =

Post Method + WinHttpRequest + multipart/form-data

一曲冷凌霜 提交于 2019-12-22 09:57:17
问题 I'm stumped why this doesn't work can't seem to find any problems. Here is the code. Public Const MULTIPART_BOUNDARY = "speed" Function getBalance() As String Dim sEntityBody As String Dim postBody() As Byte Dim username As String Dim password As String username = CStr(frmMain.txtUser.text) password = CStr(frmMain.txtPass.text) sEntityBody = "--" & MULTIPART_BOUNDARY & vbCrLf sEntityBody = sEntityBody & "Content-Disposition: form-data; name=""function""" & vbCrLf & vbCrLf & "balance" & vbCrLf

http response text fetching incomplete html

前提是你 提交于 2019-12-20 03:16:07
问题 I have a code (given below) in excel vba that fetches web page source html. The code is working fine but the html that it fetches is incomplete. When the line webpageSource = oHttp.ResponseText is executed, the variable webpageSource contains "DOCTYPE html PUBLIC ....... etc etc till the end /html" and that is how it should be. Everything is correct till here. But the next line debug.print webpageSource prints only half the html from "(adsbygoogle = window.adsbygoogle || []).push({}); ......

Getting an IStream from an OleVariant

时光毁灭记忆、已成空白 提交于 2019-12-20 02:10:50
问题 I am using Delphi along with WinHTTP to do an HTTP request to download some files from the internet, and I can do the request but I don't know how to get the IStream from the OleVariant that is returned from ResponseStream . I have spent a lot of time googling but I can't figure out how to do it. Here is what I have tried: var req: IWinHTTPRequest; instream: IStream; begin req := CoWinHTTPRequest.Create; req.Open('GET', 'http://google.com', false); req.Send(''); if req.Status <> 200 then

WinHTTP.WinHTTPRequest.5.1 does not work with PayPal sandbox after TLS 1.2

偶尔善良 提交于 2019-12-17 18:47:27
问题 PayPal sandbox just recently restricted to TLS 1.2 connection. This makes our site stop working with PayPal sandbox although it stills work with the production PayPal. In the future the production PayPal will have the same restriction. We're using classic ASP and Microsoft WinHTTP.WinHTTPRequest.5.1 component for communication with PayPal. Here's the code below. objHttp.StatusText returns "Bad Request". We're on Windows Server 2008 R2. I tried to use MSXML2.ServerXMLHTTP.6.0 instead, but it

Fetching webpage source when the response is different in logged in and logged out state

让人想犯罪 __ 提交于 2019-12-12 03:38:39
问题 With my code (given below), I capture source of my website's webpage and then I am trying to find a string with InStr and process it with Split. Everything is working but I have an issue where I need help. When I am logged in to my website supplying the username and password, I can see the string in the webpage source but when I am in a logged out state, my string is not visible in the webpage source. What changes do I need in the code which will tell the computer that I am logged in. Is this

Find the size of retrieved binary data with WinHttp.WinHttpRequest

半世苍凉 提交于 2019-12-11 03:06:28
问题 I've recently realized that URLDownloadToFile uses the IE proxy setting. So I'm looking for an alternative and found WinHttp.WinHttpRequest may work. It seems the ResponseBody property contains the fetched data and I need to write it to a file. The problem is that I cannot find the byte size of it. http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106%28v=vs.85%29.aspx has the information for the object but I don't find relevant properties for it. Can somebody tell how? strURL :=

VBA - Go to website and download file from save prompt

不羁岁月 提交于 2019-12-09 06:42:23
问题 I've been spending the last few hours trying to figure out how to save a file onto the computer using VBA. The code template below that I found on another forum seems promising, except when I go to the desktop to access it, the .csv file has what looks like the page's source code instead of the actual file I want. This may be because when I go to the URL, it doesn't automatically download the file; rather, I am asked to save the file to a certain location (since I don't know the path name of

Calling Rest API from VBA - “Connection with the server was terminated abnormally”

独自空忆成欢 提交于 2019-12-08 04:09:24
问题 I am trying to RESTfull API from Excel VBA. I already have a working version in C#: //Request Auth Token var client = new RestClient("https://api.xxx.com/exp/oauth2/v1/access_token_cors"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); request.AddParameter("application/x-www-form-urlencoded", "response_type=token&grant_type=client_credentials&client_id=1234&client_secret=1234&scope=", ParameterType.RequestBody);

Calling Rest API from VBA - “Connection with the server was terminated abnormally”

断了今生、忘了曾经 提交于 2019-12-06 17:55:24
I am trying to RESTfull API from Excel VBA. I already have a working version in C#: //Request Auth Token var client = new RestClient("https://api.xxx.com/exp/oauth2/v1/access_token_cors"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); request.AddParameter("application/x-www-form-urlencoded", "response_type=token&grant_type=client_credentials&client_id=1234&client_secret=1234&scope=", ParameterType.RequestBody); IRestResponse response = client.Execute(request); Need to port this code to VBA. I wrote: Set MyRequest =