Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Leggere contenuto txt in un server remoto

    Ho la necessità di leggere un file di testo che è fisicamente su di un altro server web.
    In pratica, leggendo questo file posso sapere se il server web è on-line. Diversamente posso deviare il visitatore su una pagina di avviso off-line.

    Come posso fare?

  2. #2
    Utente bannato
    Registrato dal
    Oct 2003
    Messaggi
    372
    codice:
    url = "http://www.domionoesterno.it/file.txt" 
    
    Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
       xmlhttp.Open "GET", url, False 
       xmlhttp.Send
       
       'quì recupero il contenuto testuale 
       pagetxt = CStr(xmlhttp.ResponseText)
       
       'quì controllo lo stato della pagina
       pagestatus = xmlhttp.Status 
    Set xmlhttp = Nothing 
    
    'se lo stato della richiesta è = 200 allora la pagina è disponibile
    If CInt(pagestatus) = 200 Then
    
       pagetxt = Replace(pagetxt,vbCrLf,"
    ")
       Response.write pagetxt 
    
    Else 
       Response.write "Si è verificato il seguente errore: " & pagestatus
    
    End If

  3. #3
    grazie

  4. #4
    Mi d errore:

    msxml3.dll error '80072ee7'
    The server name or address could not be resolved

    Il server esterno è uno spazio free.
    Cè qualche altra soluzione?

  5. #5

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.