Reading web pages

Bystroushaak bystrousak at kitakitsune.org
Fri Jan 20 06:49:08 PST 2012


With dmd 2.057 on my linux machine:

bystrousak:DHTTPClient,0$ dmd spider.d dhttpclient.d
bystrousak:DHTTPClient,0$ ./spider http://kitakitsune.org
[Contingut: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<HTML>
.....


On 20.1.2012 15:37, Xan xan wrote:
> I get errors:
>
> xan at gerret:~/yottium/@codi/aranya-d2.0$ gdmd-4.6 spider.d
> spider.o: In function `_Dmain':
> spider.d:(.text+0x4d): undefined reference to
> `_D11dhttpclient10HTTPClient7__ClassZ'
> spider.d:(.text+0x5a): undefined reference to
> `_D11dhttpclient10HTTPClient6__ctorMFZC11dhttpclient10HTTPClient'
> spider.o:(.data+0x24): undefined reference to `_D11dhttpclient12__ModuleInfoZ'
> collect2: ld returned 1 exit status
>
>
> with the file spider.d:
>
> //D 2.0
> //gdmd-4.6<fitxer>  =>  surt el fitxer amb el mateix nom i .o
> //Usa https://github.com/Bystroushaak/DHTTPClient
> import std.stdio, std.string, std.conv, std.stream;
> import std.socket, std.socketstream;
> import dhttpclient;
>
> int main(string [] args)
> {
>      if (args.length<  2) {
> 		writeln("Usage:");
> 		writeln("   ./spider {<url1>,<url2>, ...}");
> 		return 0;
> 	}
> 	else {
> 		try {
> 			HTTPClient navegador = new HTTPClient();
> 			foreach (a; args[1..$]) {
> 				writeln("[Contingut: ", navegador.get(a), "]");
> 			}
> 		}
> 		catch (Exception e) {
> 			writeln("[Excepció: ", e, "]");
> 		}
> 		return 0;
> 	}
> }
>
>
>
> What happens now?
>
> Thanks a lot,
> Xan.
>
> 2012/1/20 Bystroushaak<bystrousak at kitakitsune.org>:
>> You can always use my module:
>>   https://github.com/Bystroushaak/DHTTPClient
>>
>>


More information about the Digitalmars-d-learn mailing list