132
|
1 private import tango.io.Console;
|
|
2
|
|
3 private import tango.net.http.HttpGet;
|
|
4
|
|
5 /*******************************************************************************
|
|
6
|
|
7 Read a page from a website, gathering the entire page before
|
|
8 returning any content. This illustrates a high-level approach
|
|
9 to retrieving web-content, whereas the homepage example shows
|
|
10 a somewhat lower-level approach.
|
|
11
|
|
12 Note that this expects a fully qualified URL (with scheme),
|
|
13 such as "http://www.digitalmars.com/d/intro.html"
|
|
14
|
|
15 *******************************************************************************/
|
|
16
|
|
17 void main (char[][] args)
|
|
18 {
|
|
19 char[] url = (args.length is 2) ? args[1] : "http://www.digitalmars.com/d/intro.html";
|
|
20
|
|
21 // open a web-page for reading (see HttpPost for writing)
|
|
22 auto page = new HttpGet (url);
|
|
23
|
|
24 // retrieve and flush display content
|
|
25 Cout (cast(char[]) page.read) ();
|
|
26 }
|
|
27
|