macz Posted June 10, 2014 Share Posted June 10, 2014 Hi! Is it possible to create website (not to get some information, but to send information to server) without using Internet Explorer or any other browser? The reason why I need it is because I need to send an email if database backup file is missing on computer. I wrote a script to check that, but I need to send that email, if there is error and programm didn't find file. I tried to send mail via SMTP, but anti-virus blocked that. So I thougt that I can make php file on my server, where I can post contents using $_GET variables. For now I am using Internet Explorer, which is opened hidden, but I think that there could be better ways to do this. (Sorry if this question is already answered, I just couldn't imagine how to find something like this.. And sorry for my english..) Thanks in advance! Link to comment Share on other sites More sharing options...
Palestinian Posted June 10, 2014 Share Posted June 10, 2014 Have you checked _FTP_FilePut? Link to comment Share on other sites More sharing options...
macz Posted June 10, 2014 Author Share Posted June 10, 2014 (edited) I think this function will not do for this, because I still need to run php script.. And backup check is not only for one computer, but for like 10 computers and there is that schedule task, which run my autoit programm... Edited June 10, 2014 by macz Link to comment Share on other sites More sharing options...
Danp2 Posted June 10, 2014 Share Posted June 10, 2014 What about the >WinHttp UDF? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
macz Posted June 10, 2014 Author Share Posted June 10, 2014 Thanks a lot , I guess this is what I needed, will try later. Link to comment Share on other sites More sharing options...
macz Posted June 11, 2014 Author Share Posted June 11, 2014 Ahh, it worked perfectly until I tested it on that computer, where mail wasn't working.. I guess the same reason - firewall blocked it. Any other ideas or should I continue to use my way with IExplorer? Link to comment Share on other sites More sharing options...
Danp2 Posted June 11, 2014 Share Posted June 11, 2014 You initially said you had it working in a hidden IE window. If this is correct, then I don't see why it wouldn't work properly with WinHTTP. You need to determine exactly why it isn't working before you can fix it. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
macz Posted June 11, 2014 Author Share Posted June 11, 2014 (edited) Sorry, I can't find what is not working... $site = $query = Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, $site) ; Specify the reguest: Local $hRequest = _WinHttpOpenRequest($hConnect, Default, $query) ; Send request $hres = _WinHttpSendRequest($hRequest) MsgBox(0, 0, "SendRequest: " & $hres) If @error Then MsgBox(0, 0, "ERROR!") EndIf ;Wait for the response $resp = _WinHttpReceiveResponse($hRequest) MsgBox(0, 0, "ReceiveRequest: " & $resp) If @error Then MsgBox(0, 0, "ERROR!") EndIf Local $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header ; Clean _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen MsgBox(0,0,$sHeader) That's the code which I used.. On this computer it's working correctly, 1st MsgBox contains "SendRequest: 1" 2nd - "ReceiveRequest: 1" 3td - full with header data... But on another computer 1st - "SendRequest: 0" and there is no error... 2nd - "ReceiveRequest: 0" 3td - empty I tried to look into WinHttp.au3, but I don't understand how dll files are working and I am just a begginer in AutoIT... Edited June 11, 2014 by macz Link to comment Share on other sites More sharing options...
Danp2 Posted June 11, 2014 Share Posted June 11, 2014 From the "failing" computer, can you open this site from the browser? If not, then you need to determine what is blocking the access. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
macz Posted June 11, 2014 Author Share Posted June 11, 2014 Yes, I can open that site using browser. Link to comment Share on other sites More sharing options...
Danp2 Posted June 11, 2014 Share Posted June 11, 2014 You should add some error checking to see where your code is failing: expandcollapse popup#Include "WinHttp.au3" $site = $query = Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, $site) ; Specify the reguest: Local $hRequest = _WinHttpOpenRequest($hConnect, Default, $query) If @error Then MsgBox(0, "Error", "_WinHttpOpenRequest: " & @error) Exit EndIf ; Send request $hres = _WinHttpSendRequest($hRequest) If @error Then MsgBox(0, "Error", "_WinHttpSendRequest: " & @error) Exit EndIf ;Wait for the response $resp = _WinHttpReceiveResponse($hRequest) If @error Then MsgBox(0, "Error", "_WinHttpReceiveResponse: " & @error) Exit EndIf Local $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header If @error Then MsgBox(0, "Error", "_WinHttpQueryHeaders: " & @error) Exit EndIf ; Clean _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen MsgBox(0,0,$sHeader) Latest Webdriver UDF Release Webdriver Wiki FAQs 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