🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #3505

Re: [java] lezen van http server

#3505
From: Herman Timmermans
Date: Fri, 26 Dec 2003 13:18
109 lines
6096 bytes
TRAX wrote:

> Hmm, ik krijg een non compatible type error maar ondertussen heb ik als
> volgt opgelost, ik hou mijn hart al vast voor de lachbuien want echt
> katholiek is het niet :)
> 
> while (fromServer != null && fromServer.toLowerCase().indexOf("</html>")
> == -1){
>       System.out.print(fromServer+"\r\n");
>       /* Lees een volgende lijn in van het antwoord */
>       fromServer = input.readLine();
> }
> 
> Nu moet ie wel stoppen als hij een html closing tag tegenkomt en die zou
> ik er dan altijd manueel zelf bijschrijven in mijn html bestand dat ik
> moet parsen.
> Alles werkt perfect, behalve: www.google.be Daar stopt hij na een heel
> script, ik zie geen enkel html closing tag of geen null line maar toch
> stopt hij, strange...
> Als er iemand enig idee heeft hoe dat komt... Ik wil gerust mij code
> online zetten of hier eens posten
> 
> Alvast bedankt!

Hello,
met de code die ik je voordien heb gegeven werkt het perfect bij mij.
Dit is bv. de response header die ik terug krijg.
********************************************
Cache-control : private
Content-Type : text/html
Set-Cookie : 
PREF=ID=01de82c0e73a90b6:LD=nl:TM=1072447276:LM=1072447276:S=3W409DZmDkdgNucW; 
expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.be
Content-Encoding : gzip
Server : GWS/2.1
Content-length : 1569
Date : Fri, 26 Dec 2003 14:01:16 GMT
******************************************
Ook de content krijg ik terug, inclusief de </html> tag.
Dit is bv. de content die ik van www.google.be terug krijg.
===============================
<html><head><meta http-equiv="content-type" content="text/html; 
charset=ISO-8859-1"><title>Google</title><style><!--
body,td,a,p,.h{font-family:arial,sans-serif;}
.h{font-size: 20px;}
.q{color:#0000cc;text-decoration: none;}
//-->
</style>
<script>
<!--
function sf(){document.f.q.focus();}
// -->
</script>
</head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b 
alink=#ff0000 onLoad=sf()><center><a href="/doodle7.html"><img 
src="logos/winter_holiday_03_oh.gif" width=296 height=110 border=0 
alt="Happy Holidays from Google" title="Happy Holidays from 
Google"></a><br><br><table border=0 cellspacing=0 cellpadding=0><tr><td 
width=15>&nbsp;</td><td id=0 bgcolor=#3366cc align=center width=120 
nowrap><font color=#ffffff size=-1><b>Het&nbsp;Internet</b></font></td><td 
width=15>&nbsp;</td><td id=1 bgcolor=#efefef align=center width=120 nowrap 
onClick="" style=cursor:pointer;cursor:hand;><a id=1a class=q 
href="/imghp?hl=nl&tab=wi&ie=UTF-8"><font 
size=-1>Afbeeldingen</font></a></td><td width=15>&nbsp;</td><td id=2 
bgcolor=#efefef align=center width=120 nowrap onClick="" 
style=cursor:pointer;cursor:hand;><a id=2a class=q 
href="/grphp?hl=nl&tab=wg&ie=UTF-8"><font 
size=-1>Discussiegroepen</font></a></td><td width=15>&nbsp;</td><td id=3 
bgcolor=#efefef align=center width=120 nowrap onClick="" 
style=cursor:pointer;cursor:hand;><a id=3a class=q 
href="/dirhp?hl=nl&tab=wd&ie=UTF-8"><font size=-1>Gids</font></a></td><td 
width=15>&nbsp;</td></tr><tr><td colspan=10 bgcolor=#3366cc><img width=1 
height=1 alt=""></td></tr></table><br><form action="/search" name=f><span 
id=hf></span><table cellspacing=0 cellpadding=0><tr valign=middle><td 
width=75>&nbsp;</td><td align=center><input maxLength=256 size=55 name=q 
value="">
<script>
document.f.q.focus();
</script>
<input type=hidden name=ie value="ISO-8859-1"><input name=hl type=hidden 
value=nl><br><input type=submit value="Google zoeken" name=btnG><input 
type=submit value="Ik doe een gok" name=btnI></td><td valign=top 
nowrap><font size=-2>&nbsp;&#8226;&nbsp;<a 
href=/advanced_search?hl=nl>Geavanceerd zoeken</a><br>&nbsp;&#8226;&nbsp;<a 
href=/preferences?hl=nl>Voorkeuren</a><br>&nbsp;&#8226;&nbsp;<a 
href=/language_tools?hl=nl>Taalhulpmiddelen</a></font></td></tr><tr><td 
colspan=3 align=center><font size=-1>Zoek: <input id=all type=radio 
name=meta value="" checked><label for=all> het Internet</label><input 
id=lgr type=radio name=meta value="lr=lang_nl" ><label for=lgr> pagina's in 
het Nederlands</label><input id=cty type=radio name=meta 
value="cr=countryBE" ><label for=cty>pagina's uit  
Belgi?</label></font></td></tr></table></form><p><font 
size=-1><p></font><br>Google.be aangeboden in: <a 
href="http://www.google.be/fr">Fran?ais</a>  <a 
href="http://www.google.be/de">Deutsch</a>  <a 
href="http://www.google.be/en">English</a> <br>&nbsp;<br><br><font 
size=-1><a href=/intl/nl/ads/>Adverteer bij ons</a> - <a 
href=/intl/nl/about.html>Alles over Google</a> - <a 
href=http://www.google.com/ncr>Google.com in English</a></font><p><font 
size=-2>&copy;2003 Google - Zoekt in 3,307,998,701 
webpagina's</font></p></center></body></html>
==============================
Waarom zet je dit (fromServer = input.readLine())  niet in je while 
statement argement en wel in je body?
Mvg, Herman
-- 
Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb
Anti Spam = remove the "dot" and the "at"
Registered Linux User #264690
Technical Details
Message-ID: <3fec418b$0$20078$ba620e4c@news.skynet.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!skynet.be!skynet.be!louie!tjb!not-for-mail
References: <pmKGb.96553$GJ5.4233348@phobos.telenet-ops.be> <3febe4f6$0$6930$ba620e4c@news.skynet.be> <gXWGb.97325$8e7.4369471@phobos.telenet-ops.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,1a74d76b4dc52a6c
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2003-12-26 06:11:25 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!skynet.be!skynet.be!louie!tjb!not-for-mail
Message-ID: <3fec418b$0$20078$ba620e4c@news.skynet.be>
From: Herman Timmermans <timmermansdot.hermanat@skynet.be>
Subject: Re: [java] lezen van http server
Newsgroups: be.comp.programming
Reply-To: timmermansdot.hermanat@skynet.be
Date: Fri, 26 Dec 2003 14:18:50 +0100
References: <pmKGb.96553$GJ5.4233348@phobos.telenet-ops.be> <3febe4f6$0$6930$ba620e4c@news.skynet.be> <gXWGb.97325$8e7.4369471@phobos.telenet-ops.be>
Organization: ATUM BVBA
User-Agent: KNode/0.7.1
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Lines: 109
NNTP-Posting-Host: 80.200.212.8
X-Trace: 1072447883 reader1.news.skynet.be 20078 80.200.212.8:34040
X-Complaints-To: usenet-abuse@skynet.be