PoshCode Logo PowerShell Code Repository

wget 1.0 by teste 3 years ago (modification of post by Joel Bennett view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/4332"></script>download | new post

monitora01@monitora01:~$ wget —header=“Accept:text/xml,application/xml,application/xhtml+xml,text html;q=0.9,textplain;q=0.8;q=0.5” —header=“Accept-Language: en-GB,en;q=0.5” —header=“Accept-Encoding: gzip,deflate” —header=“Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7” —header=“Keep-Alive: 300” —ignore-length grupocelere.com.br/Cliente/
—2013-07-25 13:02:48— http://grupocelere.com.br/Cliente/
Conectando-se a 172.16.1.45:3128… conectado.
A requisição Proxy foi enviada, aguardando resposta… 302 Moved Temporarily
Localização: Pendencia.php [redirecionando]
—2013-07-25 13:02:48— http://grupocelere.com.br/Cliente/Pendencia.php
Conectando-se a 172.16.1.45:3128… conectado.
A requisição Proxy foi enviada, aguardando resposta… 302 Moved Temporarily
Localização: http://www.itecplan.com.br/Cliente/Cheque-1-Apresentacao.zip [redirecionando]
—2013-07-25 13:02:48— http://www.itecplan.com.br/Cliente/Cheque-1-Apresentacao.zip
Conectando-se a 172.16.1.45:3128… conectado.
A requisição Proxy foi enviada, aguardando resposta… 200 OK
Tamanho: ignorado [application/zip]
Salvando em: “index.html.2”

[ <=> ] 152.003 —.-K/s em 0,004s

2013-07-25 13:02:48 (32,3 MB/s) – “index.html.2” salvo [152003]

monitora01@monitora01:~$

  1. # ---------------------------------------------------------------------------
  2. ### <Script>
  3. ### <Author>
  4. ### Joel "Jaykul" Bennett
  5. ### </Author>
  6. ### <Description>
  7. ### Downloads a file from the web to the specified file path.
  8. ### </Description>
  9. ### <Usage>
  10. ### Get-URL http://huddledmasses.org/downloads/RunOnlyOne.exe RunOnlyOne.exe
  11. ### Get-URL http://huddledmasses.org/downloads/RunOnlyOne.exe C:\Users\Joel\Documents\WindowsPowershell\RunOnlyOne.exe
  12. ### </Usage>
  13. ### </Script>
  14. # ---------------------------------------------------------------------------
  15. param([string]$url, [string]$path)
  16.  
  17. if(!(Split-Path -parent $path) -or !(Test-Path -pathType Container (Split-Path -parent $path))) {
  18.   $path = Join-Path $pwd (Split-Path -leaf $path)
  19. }
  20.  
  21. "Downloading [$url]`nSaving at [$path]"
  22. $client = new-object System.Net.WebClient
  23. $client.DownloadFile( $url, $path )
  24.  
  25. $path

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me