Reading web pages
Xan xan
xancorreu at gmail.com
Fri Jan 20 06:56:24 PST 2012
Yes. I ddi not know that I have to compile the two d files, although
it has sense ;-)
Perfect.
On the other hand, I see dhttpclient identifies as
"Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.3)
Gecko/20100401 Firefox/3.6.13"
How can I change that?
2012/1/20 Bystroushaak <bystrousak at kitakitsune.org>:
> 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