+ // Try to get the input stream (connects to the given URL)
+ wxLogMessage("Establishing connection to \"%s\"...", urlname);
+ const std::auto_ptr<wxInputStream> data(url.GetInputStream());
+ if ( !data.get() )
+ {
+ wxLogError("Failed to retrieve URL \"%s\"", urlname);
+ return;
+ }
+
+ // Print the contents type and file size
+ wxLogMessage("Contents type: %s\nFile size: %i\nStarting to download...",
+ url.GetProtocol().GetContentType(),
+ data->GetSize());
+
+ // Get the data
+ wxStringOutputStream sout;
+ if ( data->Read(sout).GetLastError() != wxSTREAM_EOF )
+ wxLogError("Error reading the input stream.");
+
+ wxLogMessage("Text retrieved from URL \"%s\" follows:\n%s",
+ urlname, sout.GetString());