Slythfox Posted October 14, 2007 Posted October 14, 2007 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?
Nahuel Posted October 14, 2007 Posted October 14, 2007 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")
Slythfox Posted October 14, 2007 Author Posted October 14, 2007 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.
BrettF Posted October 14, 2007 Posted October 14, 2007 Maybe do a search for so autoit made webservers? That will probably point you in the right direction Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Slythfox Posted October 14, 2007 Author Posted October 14, 2007 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?
leos Posted October 15, 2007 Posted October 15, 2007 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
Slythfox Posted October 17, 2007 Author Posted October 17, 2007 Thanks, that worked! I didn't realize I needed to do that.
crashdemons Posted October 23, 2007 Posted October 23, 2007 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.)
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