Recomendado: asp retorna o último local de uma string % dwwwstr = divdwww.cn/divddwww.dwww.cn/div design home dwwwstr = instrrev (dwwwstr,/div) Response.Write dwwwstr % Instrrev Descrição Retorna a posição do final de uma string que aparece em outra string. Sintaxe Instrrev (String1, String2 [, Start [, Compare]]) Instrre
Quando eu estava trabalhando na empresa de manhã, vi a neve caindo do lado de fora. .
Então, encontrei uma maneira de escrever um procedimento para previsão do tempo e vi que a previsão do tempo no QQ era muito boa. . hehe. . Eu vou te pegar!
Como mostrado na imagem:
Código:
<%
'No erro de erro
'Autor: Wuqing Fonte: Por favor, mantenha a fonte ao reimprimir
Response.ContentType = Texto/HTML;
Ligue para o clima ()
Sub Weather ()
url = http: //weather.news.qq.com/inc/07_ss252.htm 'clima em Xangai
Ligue para o isobjinstalled (Microsoft.xmlhttp)
WEATHERSTR = Gethttppage (URL)
Se Weatherstr = então
Response.Write Desculpe, a previsão do tempo falhou em carregar!
outro
SET REG = NOVO REGEXP
Reg.multiline = true
reg.global = false
Reg.ignorecase = true
reg.pattern = <td altura = 77 class = wht2 lk37> ((. |/n)*?) </td>
SET MOCHES = REG.EXECUTE (WEATHERSTR)
Para cada correspondência1 em partidas
WEATHERSTR = MATCH1.VALUE
Próximo
Set Matches = nada
Definir reg = nada
Se Instr (Weatherstr, não encontrado com)> 0 então
Response.Write Desculpe, a previsão do tempo falhou em carregar!
Outro
WEATHERSTR = Substitua (Weatherstr, <td altura = 77 class = wht2 lk37>,)
WEATHERSTR = Substitua (Weatherstr, <div class = txbd>,)
WEATHERSTR = Substitua (Weatherstr, </div>,)
WEATHERSTR = Substitua (Weatherstr, </td>,)
Response.Write Shanghai Previsão do tempo: & Weatherstr &
final se
final se
Final sub
'// Use o componente microsoft.xmlhttp para coletar dados
Função Gethttppage (URL)
'No erro de erro
Dim http
Definir http = server.createObject (Microsoft.xmlHttp)
Http.open get, url, falso
Http.send ()
Se http.readyState <> 4 então
função de saída
final se
gethttppage = bytes2bst (http.Responsebody)
Defina http = nada
se err.number <> 0, então err.clear
Função final
Compartilhar: Analise a votação no programa ASP Implementation Dig O ASP faz uma votação em um programa de escavação (alguns são chamados de topo e etapa). Votivo.
2 páginas no total Página anterior 12 Próxima página