Jump to content

InetGet and referer


Recommended Posts

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 by Irongeek
Link to comment
Share on other sites

#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 by nfwu
Link to comment
Share on other sites

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 by OverloadUT
Link to comment
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
 Share

  • Recently Browsing   0 members

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