Results 1 to 4 of 4

Thread: [2005] Download file - specific headers

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Location
    Croatia~Zagreb
    Posts
    5

    Resolved [2005] Download file - specific headers

    I need help downloading file, for example http://www.hrt.hr/index.xml
    But I need that headers to look like these:


    GET /index.xml HTTP/1.1
    Host: www.hrt.hr
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
    Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Referer: http://vb.bloger.hr/
    Pragma: no-cache
    Cache-Control: no-cache


    I have tried this:
    VB Code:
    1. Dim down As New Net.WebClient
    2.         down.Headers.Set(Net.HttpRequestHeader.Host, "www.hrt.hr")
    3.         down.Headers.Set(Net.HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1")
    4.         down.Headers.Set(Net.HttpRequestHeader.Accept, "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5")
    5.         down.Headers.Set(Net.HttpRequestHeader.AcceptLanguage, "en-us,en;q=0.5")
    6.         down.Headers.Set(Net.HttpRequestHeader.AcceptCharset, "ISO-8859-1,utf-8;q=0.7,*;q=0.7")
    7.         down.Headers.Set(Net.HttpRequestHeader.KeepAlive, "300")
    8.         down.Headers.Set(Net.HttpRequestHeader.Connection, "keep-alive")
    9.         down.Headers.Set(Net.HttpRequestHeader.Referer, "http://www.vb.bloger.hr/")
    10.         down.Headers.Set(Net.HttpRequestHeader.Pragma, "no-cache")
    11.         down.Headers.Set(Net.HttpRequestHeader.CacheControl, "no-cache")
    12.         down.DownloadFile("http://www.hrt.hr/index.xml", "C:\Downloads\test1.txt")

    I also tried with:
    VB Code:
    1. down.Headers.Add
    But non of them work.

    Please help.
    Last edited by tomoslav; Feb 9th, 2007 at 05:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width