Jump to content

Recommended Posts

Posted

I want to avoid using IE to make a http server request. I have a working apache server, and have set up a php script called write.php that will write to a file if it is accessed.

I know this isn't working because the file hasn't been written to (the write.php file has been tested).

#include <GUIConstants.au3>
TCPStartUp()

Dim $ConnectedSocket = -1
$ConnectedSocket = TCPConnect("192.168.0.6",80)

Dim $szData

If @error Then
    MsgBox(4112,"Error","TCPConnect failed with WSA error: " & @error)
Else
    TCPSend($ConnectedSocket,"GET /write.php HTTP/1.1\r\nHost: 192.168.0.6\r\n\r\n")
EndIf

What am I doing wrong?

Posted

Well... I'm not sure.. but I think that all this does is send a string:

TCPSend($ConnectedSocket,"GET /write.php HTTP/1.1\r\nHost: 192.168.0.6\r\n\r\n")
Posted

  Nahuel said:

Well... I'm not sure.. but I think that all this does is send a string:

TCPSend($ConnectedSocket,"GET /write.php HTTP/1.1\r\nHost: 192.168.0.6\r\n\r\n")
That's how stuff works. For example, in IRC you use stuff like PRIVMSG NickServ :IDENTIFY

I did some packet sniffing, but I can't seem to get this HTTP TCP stuff to work.

Posted

  Bert said:

Maybe do a search for so autoit made webservers? That will probably point you in the right direction :)

I've been looking at those and haven't found anything that leads me to anything.

Is it really that hard to request (but not download) a page on a web server, without the use of the IE libraries?

Posted

Instead of:

TCPSend($ConnectedSocket,"GET /write.php HTTP/1.1\r\nHost: 192.168.0.6\r\n\r\n")

You should try:

TCPSend($ConnectedSocket,"GET /write.php HTTP/1.1" & @CRLF & "Host: 192.168.0.6" & @CRLF & @CRLF)

Probably you grabbed your code from some PHP code but in Autoit you'll have to use @crlf instead of \r\n

Posted

Some servers will require you to have additional lines on your requests to specify the host you want and the connection type.

I have some semi-private UDF's of my own that I use for HTTP, it's not complicated once you figure it out.

This page has alot of info on HTTP:

http://www.jmarshall.com/easy/http/

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...