Sign in to follow this  
Followers 0
macz

Open website without web browser.

11 posts in this topic

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! :)

Share this post


Link to post
Share on other sites



Have you checked _FTP_FilePut?

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by macz

Share this post


Link to post
Share on other sites

Thanks a lot :) , I guess this is what I needed, will try later.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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. :shifty:

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by macz

Share this post


Link to post
Share on other sites

From the "failing" computer, can you open this site from the browser? If not, then you need to determine what is blocking the access.

Share this post


Link to post
Share on other sites

Yes, I can open that site using browser.

Share this post


Link to post
Share on other sites

You should add some error checking to see where your code is failing:

#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)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0