<%
Dim Http,varTxt
Set Http = Server.CreateObject("Microsoft.XMLHTTP")
Http.open "GET","http://www.boatshop24.com/web/it/haendler_homepages/gdd41174/liste.htm",False
Http.Send()
varTxt = Http.ResponseText
Set Http=Nothing
dim start,inizio_txt,spos,epos,indice,arrBarche()
start=1
inizio_txt=""
fine_txt=""
indice=0
while not instr(start, varTxt, inizio_txt)=0
spos=instr(start, varTxt, inizio_txt)
epos=instr(spos+len(inizio_txt),varTxt,fine_txt)
redim preserve arrBarche(indice)
arrBarche(indice)=mid(varTxt,spos,epos-spos)
start=epos+len(fine_txt)
indice=indice+1
wend
'estraggo per ogni barca i seguenti dati:
'id,lunghezza,larghezza,anno di costruzione,motori,peso,nome,pescaggio
dim arrId(),arrLung(),arrLarg(),arrAnno(),arrMotori(), arrPeso(),arrNome(),arrPos(),arrPescaggio(), arrlink()
redim arrId(indice): redim arrLung(indice):redim arrLarg(indice): redim arrAnno(indice):redim arrMotori(indice): redim arrPeso(indice): redim arrNome(indice): redim arrPos(indice): redim arrPescaggio(indice): redim arrlink(indice)
conta=0: dati_txt=""
for each barca in arrBarche
'estraggo l'id
start=instr(1,barca,dati_txt)+len(dati_txt)
spos=instr(start,barca,"showid=")+len("showid="): epos=instr(spos,barca,""">")
arrId(conta)=mid(barca,spos,epos-spos)
'estraggo il nome
start=epos: spos=instr(start,barca,"[b]")+39: epos=instr(spos,barca,"</a>")
arrNome(conta)=mid(barca,spos,epos-spos)
'estraggo la lunghezza
start=epos: spos=instr(start,barca,"Lunghezza:")+len("Lunghezz a:"): epos=instr(spos,barca,";")
arrLung(conta)=mid(barca,spos,epos-spos)
'estraggo la larghezza
start=epos: spos=instr(start,barca,"Larghezza:")+len("Larghezz a:"): epos=instr(spos,barca,";")
arrLarg(conta)=mid(barca,spos,epos-spos)
'estraggo il pescaggio se presente
start=epos
if instr(start,barca,"Pescaggio:")>0 then
spos=instr(start,barca,"Pescaggio:")+len("Pescaggi o:"): epos=instr(spos,barca,";")
arrPescaggio(conta)=mid(barca,spos,epos-spos)
else
arrPescaggio(conta)=""
end if
'estraggo l'anno di costruzione se presente
start=epos
if instr(start,barca,"Anno di costruzione:")>0 then
spos=instr(start,barca,"Anno di costruzione:")+len("Anno di costruzione:"): epos=instr(spos,barca,";")
arrAnno(conta)=mid(barca,spos,epos-spos)
else
arrAnno(conta)=""
end if
'estraggo la posizione se presente
start=epos
if instr(start,barca,"Posizione:")>0 then
spos=instr(start,barca,"Posizione:")+len("Posizion e:"): epos=instr(spos,barca,";")
arrPos(conta)=mid(barca,spos,epos-spos)
else
arrPos(conta)=""
end if
'estraggo i motori
start=epos+1: spos=start
epos=instr(start,barca,"</td>")
if instr(start,barca,"Peso:")>0 then epos=instr(start,barca,"Peso:")
arrMotori(conta)=mid(barca,spos,epos-spos)
'estraggo il peso se presente
start=epos
spos=instr(start,barca,"Peso:")
if spos>0 then
spos=spos+len("Peso:")
epos=instr(spos,barca,"</td>")
arrPeso(conta)=mid(barca,spos,epos-spos)
else
arrPeso(conta)=""
end if
'estraggo i Link
start=epos:
spos=instr(start,barca,"<a href=")+1: epos=instr(spos,barca,"</a>")
arrlink(conta)=mid(barca,spos,epos-spos)
arrLink(conta)=replace(arrLink(conta),"href=""","t arget=""_blank"" href=""http://www.boatshop24.com/web/it/haendler_homepages/gdd41174/")
arrLink(conta)=replace(arrLink(conta),"src=""","sr c=""http://www.boatshop24.com")
conta=conta+1
next
'stampo il riepilogo:
dim riepilogo
for i=0 to ubound(arrBarche)
riepilogo="<center><font color='#165C87' face='Arial Narrow' size='2'>
Nome barca:
" & arrNome(i) & "
" &_
"Id barca:
" & arrId(i) & "
"&_
"Lunghezza:
" & arrLung(i) & "
"&_
"Larghezza:
" & arrLarg(i) & "
"&_
"Anno di costruzione:
" & arrAnno(i) & "
"&_
"Pescaggio:
" & arrPescaggio(i) & "
"&_
"Posizione:
" & arrPos(i) & "
"&_
"Motori:
" & arrMotori(i) & "
"&_
"Peso:
" & arrPeso(i) & "
"&_
"
" & arrlink(i) & "
"&_
"
</font></center>"
response.write riepilogo
next
%>