WinHttp method POST

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

WinHttp method POST

09 Jun 2019, 10:55

Hello,

i want launch internet explorer with for exemple : " https://www.01net.com/telecharger/ "
and add in form search " searchstring " the value " %string_Name% " and launch this search with " Enter " ?
and finish, get response page to one file.

For example :
https://www.google.com/search?q=test
ok it works but I want to do it with another site. If this solution is possible, I will use the function AHK "UrlDownloadToFile" or "Download"

For this i think use :
AHK V1 : UrlDownloadToFile
AHK V2 : Download
and
WinHttp with POST ?

I do not know how to do ! Can you help me get on the right path?

[Mod edit: Topic moved to 'Ask for Help']
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: WinHttp method POST

11 Jun 2019, 01:08

The problem is, that every site has different options for the search string. Google uses "q=". Your example uses "searchstring=". I don't think, that there will be a universal solution.

Code: Select all

InputBox, var, Search String, Input
UrlDownloadToFile, https://www.01net.com/recherche/recherche.php?searchstring=%var%, c:\temp\url.html
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: WinHttp method POST

13 Jun 2019, 09:00

Hi :)

Great ! Thank you for your answer
it's OK for my i have a good argument with my URL.

Now i have another problem, UrlDownloadToFile don't work
example

Code: Select all

url UrlDownloadToFile, %URL_Link%, c:\temp\url.html
Because under IE windows already open I am authenticated and UrlDownloadToFile opens a new IE window and there I have an authentication error

An idea ?
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: WinHttp method POST

13 Jun 2019, 12:43

I think, that URLDownloadToFile creates a separate process, therefore the authentication of IE doesn't work. I didn't find anything how to authenticate for that. Probably there is no solution for that.

I would go the next step. In the documentation of the URLDownloadToFile (https://www.autohotkey.com/docs/commands/URLDownloadToFile.htm) there is an example (the second one) with com. I would try it that way.
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: WinHttp method POST

16 Jun 2019, 09:11

hello, you're right that's what I tried to do ...
do not use --> whr: = ComObjCreate (" WinHttp.WinHttpRequest.5.1 ")
I tried without success --> whr: = ComObjActive (" InternetExplorer.Application ") ( uses IE which is open , i think )
I do not have the right synthax, can you help me?
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: WinHttp method POST

16 Jun 2019, 15:58

I turn around the problem.

create a new window, works but authentication problem.

Code: Select all

whr: = ComObjCreate ("WinHttp.WinHttpRequest.5.1")

But the simple command "run" allows to launch the link in an existing IE window and it works! nice.

Code: Select all

Run, C:\Program Files\Internet Explorer\iexplore.exe www.01net.com, , , IE_PID
Now all I have to do is get the source code from the internet explorer window.

Is it possible to use:

Code: Select all

UrlDownloadToFile, ahk_pid %IE_PID%, IE_Data.html
can we use WinGetText with Internet Explorer?
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 316 guests