Well, after multiple attempts at a wget PowerShell script (the last one works very well for downloading web pages, files, as long as you don’t need to send post parameters or anything like that) ... I found myself writing a script last week that included a custom HTTP POST function as well as using some prior functionality I wrote (ConvertFrom-Html) to convert HTML files to XML documents — which PowerShell can deal with nicely.

So I’ve taken my Huddled.Html code and worked it in together with a few extra bits … and I’m releasing it under the new name “PoshHttp” (which has the sole benefit of being short, in the case when you need to type the full command names, like: PoshHttp\Get-Web.

In lieu of providing proper documentation for this, there’s a script below which shows off some of the features of the Get-Web cmdlet … but first, you’re going to want to download PoshHttp and I can give you a basic overview.

Get-Web

Downloads a file from the web URI (Uniform Resource Identifier), optionally passing POST or GET parameters which it accepts as a Hashtable. If the resulting file is an xml or html file, it converts it to XML and outputs it as an XmlDocument object. If they are not, it saves them to file, and outputs the FileInfo object.

  • Plain will prevent the conversion to xml
  • Save will force saving to file (either xml or binaries)
  • Path lets you specify the file name/path (normally, it selects a path based on what you’re downloading).
  • Force will prevent it from asking if you want to overwrite files

ConvertFrom-Html

Converts HTML to XML. I’ll eventually tweak this so it supports passing it a file path and even saving the xml in-place on the original file … but for now you can use it on a stream of text, like this: (Get-Content file.html | ConvertFrom-Html).save( "file.xml" ). Note that it outputs an xmldocument object … you can get the xml as text to the console using Get_OuterXml().

ConvertTo-Hashtable

Converts a url-style query string or NameValueCollection into a Hashtable. It’s mainly to make it easier to use the Get-Web in cases where you’re getting the URL or POST data from elsewhere.

Here’s a script with a few example uses of Get-Web: (more…)

This “Web 2.0” nonsense is still ridiculous, and I thought I’d just throw this out there to express my annoyance. The one thing you’ll notice here is that at no point do we get a new version just because you started using the same old tech for different purposes. Water does not become Water 2.0 just because you use it to wash your car instead of drinking it, nor because you put it in bottles and pretend it’s worth it’s weight in gasoline. Neither does the web get a new version just because some corporate muckety-muck discovered blogging, nor even when someone finally notices XmlHttpRequest and dreams up a new acronym for “fetching data from a webservice via a javascript in a web page”. What we can do is change the version number when we make a significant change in the underlying technologies.

  • HTML = 1.0
  • Client-Side Script (Js/Vbs) = 2.0
  • Style Sheets = 2.5
  • Server-Side Scripting (Perl/Php/etc)= 3.0
  • Server-Side Databases = 3.5 (the first real web apps — apps that didn’t just manipulate something you already has)
  • XML and XmlHttpRequest (partial page reloads) = 4.0
  • The single-browser web (Netscape dies and the web becomes a uniform platform of IE5 compatible sites). = 4.1

And at some future point in time …

  • Client-Side Databases = 5.0 (this is in the HTML5 spec released this month)
  • Rise of MicroFormats = 6.0 (this is where microformats emerge as recognized standards)
  • Social Web = 7.0

In the Social Web, browsers become true portals, with integrated identity management, instant messaging, contact management and feed aggregation. Micro-formats are one of the supported standards, and browsers can parse them and store and track their information. When you comment on a website, your OpenID is tracked with a microformat vcard, plus your browser offers to ping your OpenId enabled tracking service so your friends can follow a central feed of all your comments and forum participation across the whole web (based on your anonymous OpenID). All of this happens without third party plugins that nobody installs.

So yeah … Web 2.0? The Social Web? No. I think not.