Checking to see if a file exists online or not.

Everything else that doesn't fall into one of the other PB categories.
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Checking to see if a file exists online or not.

Post by kawasaki »

Hi.. im making a program that needs to know if a file is online or not. I have so far tried the procedure i found in the purearea code archive (below) and it will only tell me if a site exists rather than a resource like images, sounds etc... anybody?

Code: Select all

; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=1654&highlight=
; Author: Danilo + ChipMunk
; Date: 09. July 2003

#NETWORK_ALIVE_AOL = $4 
#NETWORK_ALIVE_LAN = $1 
#NETWORK_ALIVE_WAN = $2 

Structure QOCINFO 
    dwSize.l     ; As Long 
    dwFlags.l    ; As Long 
    dwInSpeed.l  ; As Long 'in bytes/second 
    dwOutSpeed.l ; As Long 'in bytes/second 
EndStructure 

Procedure IsDestinationReachable(lpszDestination.s,*lpQOCInfo.QOCINFO) 
  hLib = LoadLibrary_("SENSAPI.DLL") 
  If hLib 
    hProc = GetProcAddress_(hLib,"IsDestinationReachableA") 
    If hProc 
      ProcedureReturn CallFunctionFast(hProc,lpszDestination,*lpQOCInfo) 
    EndIf 
    FreeLibrary_(hLib) 
  EndIf 
EndProcedure 

; 
; KPD-Team 2001 
; URL: http://www.allapi.net/ 
; E-Mail: KPDTeam@Allapi.net 
; 
; PureBasic-Translation 
; by Danilo, 09.07.2003 
; 
Ret.QOCINFO 
Ret\dwSize = SizeOf(QOCINFO)

CrLf.s = Chr(13)+Chr(10) 

If IsDestinationReachable("www.PureBasic.com",Ret) = 0 
  MessageRequester("ERROR","The destination cannot be reached!",#MB_ICONERROR) 
Else 
  MessageRequester("INFO","The destination can be reached!"+CrLf+"The speed of data coming in from the destination is "+StrU(Ret\dwInSpeed/1024,#LONG)+".0 Kb/s,"+CrLf+"and the speed of Data sent To the destination is "+StrU(Ret\dwOutSpeed/1024,#LONG)+".0 Kb/s.",#MB_ICONINFORMATION) 
EndIf