XML HTTP request Weather


/ Published in: ASP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <%
  2. Dim StrUrl, strCorpo, strTemperatura, StrSensacao, StrImagem, StrClima, StrCidade
  3. Dim arr, arrTemperatura, ArrClima, ArrImagem, ArrSensacao, ArrCidade
  4. Dim objXMLHTTP, strXmlHttp
  5. StrUrl = "http://br.weather.com/weather/local/BRXX0109" 'url da cidade desejada
  6. Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
  7. objXMLHTTP.open "get", StrUrl,false
  8. objXMLHTTP.send
  9. strXmlHttp = objXMLHTTP.responseText
  10. set objXMLHTTP = nothing
  11.  
  12. function limpa(str)
  13. Dim var
  14. var = replace(trim(str),"""","")
  15. var = replace(var,">","")
  16. var = replace(var,"xt","")
  17. var = replace(var,"TeT","T")
  18. var = replace(var,"Text","")
  19. var = replace(var,"OP","")
  20. var = replace(var,"Sensa&ccedil;&atilde;o de&nbsp;","")
  21. limpa=var
  22. end function
  23.  
  24.  
  25. 'Array global para pegar apenas a tabela que contem as informações desejadas
  26. arr=split(strXmlHttp,"<!-- insert reported by and last updated info -->")
  27. strCorpo = mid(arr(1),1,6300)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.