Jump to content

Possible to change InetGet() user-agent ?


Recommended Posts

Not as far as i know.... but you can.

A. use an IE object and change the user-agent in there.

B. write the entire TCP-IP connection stream and have it send the request with whatever user-agent you wish.

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://clandepotstatus.100webspace.net/test.php")
$oHTTP.SetRequestHeader("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; InfoPath.1)")
$oHTTP.Send()

$Headers = $oHTTP.GetAllResponseHeaders() 
ConsoleWrite("+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HEADERS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" & @CRLF)
ConsoleWrite($Headers & @CRLF)

$Source = $oHTTP.ResponseText
ConsoleWrite("+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CONTENT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" & @CRLF)
ConsoleWrite($Source & @CRLF)

Func MyErrFunc()
   $HexNumber=hex($oMyError.number,8)
   Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _
                "Number is: " & $HexNumber & @CRLF & _
                "Windescription is: " & $oMyError.windescription )

   SetError(1)
Endfunc

Link to comment
Share on other sites

Thank you very much. To chance user-agent works fine, but now I have no idear how to download files with this like with InetGet.

What i need is to download binary files...

Can you help me ? :)

Link to comment
Share on other sites

Thank you very much. To chance user-agent works fine, but now I have no idear how to download files with this like with InetGet.

What i need is to download binary files...

Can you help me ? :)

In the case of a file you use FileOpen in binary mode and use $oHTTP.ResponseText or $oHTTP.ResponseBody to write to the file.

See this vbscript example:

http://cwashington.netreach.net/depo/view.asp?Index=1080

Edited by weaponx
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...