..:: MX Studio Fóruns ::..: Cotaçãos do dolar - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cotaçãos do dolar

#1 User is online   xanburzum 

  • Group: Administrador
  • Posts: 2073
  • Joined: 04-November 08

Posted 04 October 2011 - 10:14 AM

<%
'instanciando objeto
Set objxml = Server.CreateObject("Microsoft.XMLHTTP") 
'abrindo pagina
objxml.open "GET", "http://www.investshop.com.br/mer/include/Dolar.csv", false 


objxml.send()
cotacao = objxml.ResponseText
cotacoes = replace(cotacao,"Nome;Compra;Venda;Variacao","") ' Tira a primeira parte que eh lixo

' Coloca Valores em uma Array
Dim valores()
Dim cont, cont_valores
For cont = 1 To Len(cotacoes) Step 1
        If (mid(cotacoes,cont,1) = ";") Or (mid(cotacoes,cont,1) = " ") Or (mid(cotacoes,cont,1) = Chr(10)) Then
                cont_valores = cont_valores + 1
                Redim Preserve valores(cont_valores)
                valores(cont_valores) = Cstr(str)
                str = ""
        Else
                  str = str + mid(cotacoes,cont,1)
        End If 
next
' Fim Coloca valores em uma Array

' Coloca os valores nas variaveis
DOLAR_COMERCIAL_COMPRA = valores(3)
DOLAR_COMERCIAL_VENDA = valores(4)
DOLAR_COMERCIAL_VARIACAO = valores(5)

DOLAR_PARALELO_COMPRA = valores(7)
DOLAR_PARALELO_VENDA = valores(8)
DOLAR_PARALELO_VARIACAO = valores(9)

DOLAR_TURISMO_COMPRA = valores(11)
DOLAR_TURISMO_VENDA = valores(12)
DOLAR_TURISMO_VARIACAO = valores(13)

' Fim coloca os valores nas variaveis

'Destruindo o Objeto ASPHTTP
Set HttpObj = Nothing

response.Write("dolar comercial compra:") 
response.Write(DOLAR_COMERCIAL_COMPRA &"<br />")
response.Write("dolar comercial venda:") 
response.Write(DOLAR_COMERCIAL_VENDA &"<br />")

response.Write("dolar paralelo compra:") 
response.Write(DOLAR_PARALELO_COMPRA &"<br />")
response.Write("dolar paralelo venda:") 
response.Write(DOLAR_PARALELO_VENDA &"<br />")

response.Write("dolar turismo compra:") 
response.Write(DOLAR_TURISMO_COMPRA &"<br />")
response.Write("dolar turismo venda:")
response.Write(DOLAR_TURISMO_VENDA &"<br />")

%>

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)