Reading web pages

Xan xan xancorreu at gmail.com
Sat Jan 21 04:09:21 PST 2012


The full code is:;

//D 2.0
//gdmd-4.6 <fitxer> dhttpclient => surt el fitxer amb el mateix nom i .o
//Usa https://github.com/Bystroushaak/DHTTPClient
//versió 0.0.3
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 {
			string[string] capcalera = dhttpclient.FFHeaders;
			HTTPClient navegador = new HTTPClient();
			navegador.setClientHeaders(capcalera);

			foreach (a; args[1..$]) {
				write("[Longitud: ");
				stdout.rawWrite(cast(ubyte[]) navegador.get(a));
				writeln("]");
			}
		}
		catch (Exception e) {
			writeln("[Excepció: ", e, "]");
		}
		return 0;
	}
}


I don't know what happens!!!

And no, I don't live in Czech Republic: we have to postpone the invitation ;-)




2012/1/20 Bystroushaak <bystrousak at kitakitsune.org>:
> On 20.1.2012 18:42, Xan xan wrote:
>>
>> Thank you very much. I should invite you to a beer ;-)
>
>
> Write me if you will be in prag/czech republic :)
>
>
>> For the other hand,
>>
>> I get this error:
>>
>> [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640):
>> Can't convert value `HTT' of type string to type uint]
>
>
> This is very strange error, because on my computer it works well. Can you
> remove try..catch and post full error list and program parameters?


More information about the Digitalmars-d-learn mailing list