Irongeek Posted July 23, 2006 Share Posted July 23, 2006 (edited) When you use InetGet is there a way to set the agent? I'd like to write a front end for Wigle and it would help because it changes output depending on the agent. Thanks. /edit: Oops, I mean set the agent. Edited July 23, 2006 by Irongeek Link to comment Share on other sites More sharing options...
nfwu Posted July 23, 2006 Share Posted July 23, 2006 (edited) #cs GET /myfiles/game/game.php?user=nfwu HTTP/1.1 User-Agent: AutoIt v3 Host: zerocool60544.t35.com Cache-Control: no-cache #ce Func OnAutoItStart() TCPStartup() EndFunc Func _INetGet_Mod($host, $request, $useragent) $socket = TCPConnect( TCPNameToIP($host), 80 ) If $socket = -1 Then Return "Error" TCPSend($socket, _ "GET " & $request & " HTTP/1.1" & @CRLF & _ "User-Agent: " & $useragent & @CRLF & _ "Host: " & $host & @CRLF & _ "Cache-Control: no-cache" & @CRLF & _ @CRLF ) Local $recv Do $recv &= TCPRecv($socket,2048) Until @error Return $recv EndFunc Sample Usage: _INetGet_Mod("www.autoitscript.com", "/forum/index.php", "AutoIt v3") #) Edited July 23, 2006 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
OverloadUT Posted July 23, 2006 Share Posted July 23, 2006 (edited) That code will work, but the output will be the raw packets as opposed to the actual data of the response. In the case of a chunked response, it would be a real pain to write a parser...... a pain that I already went through, so you shouldn't have to! I recommend checking out my HTTP UDF's - one of the features is that you can set the User-Agent. Edited July 23, 2006 by OverloadUT Link to comment Share on other sites More sharing options...
Irongeek Posted July 23, 2006 Author Share Posted July 23, 2006 Thanks guys. 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