Jump to content

Download - Referrer


Recommended Posts

I download a file with an autoit script. and then I look into my server logfile, I see AutoIt as referrer

LOL, that is one vague little screenshot, since you're having trouble offering the information, I'll ask you for it:

What kind of file? (Looking for a filetype here)

What kind of server? FTP? WWW? (Protocol)

What kind of server as in Apache or something else? (would help if anyone's already familiar with what you're using)

What are you expecting to see that you're not seeing? (what should it be showing)

How are you downloading the file with the AutoIt script? (are you using INetGet or something else)

You said you're using an autoit script to download a file, we'd love to see it posted which would answer a lot of these questions for you.

*Edit - Come on now, you've got 217 posts and you don't include all of this stuff when asking for help?

Edited by exodius
Link to comment
Share on other sites

  • Developers

And how can I change the referrer? I would like to use File-Loader as Referrer.

You totally lost me... why ? what is a fileloader?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Show me the column header for that column you show in your screenshot. If it doesn't say "user-agent" then you have a piece of shit software written by people who don't know how HTTP works.

Hint: It's called USER AGENT. The referrer is something completely different.

Link to comment
Share on other sites

Edit: Go with the UDF in the next post, its more complete :P

Hey,

Thats the UserAgent, anyway this should work in most cases.

_INetGetEx("http://www.autoitscript.com/index.php", @ScriptDir & "\test.txt", True, "AutoIt3Script", "Referrer")


;================================================================================
; Function Name....: _INetGetEx
; Description......: Download a file from the net
; Syntax...........: _INetGetEx($sURL, $sFile[, $fOverWriteCreate = Default[, $sUserAgent = Default[, $sReferrer = Default]]])
; Parameter(s).....: $sURL - The URL of the file to download
;                    $sFile - The local path to save the file to
;                    $fOverWriteCreate - Set to True to overwrite existing file
;                    $sUserAgent - The User-Agent (http://en.wikipedia.org/wiki/User_agent)
;                    $sReferrer - The Referrer (http://en.wikipedia.org/wiki/Referrer)
; Return Value(s)..: Success: 1
;                    Failure: 0 ; sets @error to non-zero and @extended to the returned HTTP Status
;                     @error = 1: $fOverWriteCreate is False and file already exists
;                     @error = 2: Somethng went wrong with the download
; Requirement(s)...: -
; Related..........: -
; Limitation(s)....: -
; Example(s).......: -
; Comment(s).......: http://www.paulsadowski.com/WSH/getremotebinaryfile.htm
; Author(s)........: Robjong
; Modified.........: -
;================================================================================
Func _INetGetEx($sURL, $sFile, $fOverWriteCreate = Default, $sUserAgent = Default, $sReferrer = Default)
;~  Local $adTypeBinary = 1, $adSaveCreateNotExist = 1, $adSaveCreateOverWrite = 2
    Local $iSaveCreateOverWrite = 1
    If $fOverWriteCreate Then $iSaveCreateOverWrite = 2
    If $fOverWriteCreate <> 2 And FileExists($sFile) Then Return SetError(1, 0, 0)
    If Not $sUserAgent Or $sUserAgent <= -1 Or $sUserAgent == Default Then $sUserAgent = "AutoIt3Script" ; AutoIt
    If Not $sReferrer Or $sReferrer <= -1 Or $sReferrer == Default Then $sReferrer = ""
    
    Local $oHTTP = ObjCreate('WinHTTP.WinHTTPRequest.5.1')
    $oHTTP.Open('GET', $sURL, False)
    If $sUserAgent Then $oHTTP.SetRequestHeader("User-Agent", $sUserAgent)
    If $sReferrer Then $oHTTP.SetRequestHeader("Referrer", $sReferrer)
    $oHTTP.Send()
    
    Local $oBinaryStream
    If $oHTTP.Status == 200 Then ; 200 = OK
        $oBinaryStream = ObjCreate("ADODB.Stream")
        $oBinaryStream.Type = 1
        $oBinaryStream.Open
        $oBinaryStream.Write($oHTTP.ResponseBody)
        $oBinaryStream.SaveToFile($sFile, Int($iSaveCreateOverWrite))
        $oBinaryStream.Close
        Return SetError(0, 0, 1)
    EndIf
    
    $oBinaryStream.Close
    Return SetError(1, $oHTTP.Status, 0)
EndFunc   ;==>_INetGetEx
Edited by Robjong
Link to comment
Share on other sites

So how thick is his skull? Place your bets now...

EDIT: And I imagine the person that wrote that is saying that the user agent is the browser?

Edited by BrettF
Link to comment
Share on other sites

Blame the OP for not being able to keep columns straight. Blame the crappy software for making an over-generalization and considering every client a browser which is patently retarded.

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...