Tjalve Posted August 20, 2014 Share Posted August 20, 2014 Hi everyone. I have script that i use to connect to webbservice (sending a csv file). It also downloads data rom the internet usi9ng inetget. Everything works fine, except when the program is run behind a proxy. If i use httpsetproxy i can get inetget function to work. However i cant get my httpget/httppost functions to work. So im looking for suggestions on workarounds or other possabilities? here is an example code. expandcollapse popup#include <winhttp.au3> #include <md5.au3> $choise = MsgBox(3,"Välj","Ja = Använd Ingen proxy, Nej = Använd samma inställningar som Internet Explorer, Avbryt = Ange själv.") if $choise = 7 then HttpSetProxy(0) if $choise = 2 then $string = InputBox("Proxy","Ange hela procy strängen som ska testas") HttpSetProxy(2,$string) EndIf $keff = InetRead("http://vecka.nu",1) if $keff <> "" then $keff = "OK" if $keff = "" then $keff = "FAIL" MsgBox(0,"Testar InetGet:",$keff) $resultat = _testwebbservice() If $resultat = "OK" Then MsgBox(0, "OK", "Webbservice svarade: OK.") Else MsgBox(0, "ERROR", "Webbservice svarade: " & $resultat) EndIf Func _testwebbservice() $adress = "servername.se" $path = "/api/uploadcsv" $data = "Testar Webbservice!" $data_enc = _httpencodestring($data) $filename = "testfil.dat" $description = _httpencodestring($filename) $socket = _httpconnect($adress, 80) $hash = _httpencodestring(md5($data & $filename & "hashpassword")) _httppost($adress, $path, $socket, "data=" & $data_enc & "&description=" & $description & "&md5sum=" & $hash) $answer = _httpread($socket, 0) If $answer = "0" Then Return "server svarade inte" EndIf If StringInStr($answer, "error") Then $answer = StringStripWS(StringReplace(StringReplace($answer, "{", ""), "}", ""), 8) Return $answer Else Return "OK" EndIf EndFunc Link to comment Share on other sites More sharing options...
MikahS Posted August 20, 2014 Share Posted August 20, 2014 Have a look at the >AutoProxy UDF. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Tjalve Posted August 20, 2014 Author Share Posted August 20, 2014 Have a look at the >AutoProxy UDF. Im sorry, but i dont see how that helps me? Link to comment Share on other sites More sharing options...
MikahS Posted August 20, 2014 Share Posted August 20, 2014 "So im looking for suggestions on workarounds or other possabilities?" You said it yourself Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Tjalve Posted August 21, 2014 Author Share Posted August 21, 2014 I just dont see how it helps me? Link to comment Share on other sites More sharing options...
MikahS Posted August 21, 2014 Share Posted August 21, 2014 Where did you get the winhttp.au3 I'm having a hard time finding it. Any chance you remember where you got it from? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
ripdad Posted August 21, 2014 Share Posted August 21, 2014 HttpSetProxy, InetGet and InetRead rely on IE functions... whereas WinHTTP does not. There should be provisions for a proxy in WinHTTP. "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
jguinch Posted August 21, 2014 Share Posted August 21, 2014 WinHTTP.au3 can be found in the Winhttp link in >this page. I did not try it, but this UDF contains a _WinHttpSetDefaultProxyConfiguration function. Of course, this is for winhttp functions only, not for TCPConnect... Perhaps it may be appropriate. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now