Sign in to follow this  
Followers 0
Tiger

Download - Referrer

17 posts in this topic

How can I set the Referrer of an autoit script. If I load a file from my server, then stands in the log file AutoIt as referrer. How can I change that?


My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites



Please be more accurate...

I don't get what you mean.

Are you downloading the file with a AutoIt script?


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

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

post-21671-1235935957_thumb.png


My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

LOL.

I use INetGet. And that is a http-download. I would like to change the referrer. In the moment is AutoIt the referrer.


My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites

Referer is the site the person was browsing and contained the reference to your server/site.

The man speaks the truth. So I take it from your response Jos that INetGet shouldn't cause the Referrer to show as coming from AutoIt?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Edited by Tiger

My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Sry. autoit is browser, and i would like to change that in another name

post-21671-1235937717_thumb.png


My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0