- To: mathgroup at smc.vnet.net
- Subject: [mg111659] Re: ExistsURLQ
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Mon, 9 Aug 2010 05:14:13 -0400 (EDT)
- References: <firstname.lastname@example.org>
Couldn't you just use Import? It can read from URLs and returns $Failed when it can't. Cheers -- Sjoerd On Aug 8, 1:21 pm, E. P=E9rez Herrero <enriqueperezherr... at gmail.com> wrote: > Hello everybody: > > I=B4m trying to find the best way to test if any internet link is > available or not, something similar to FileExistsQ, but with a web > URL. > > As I could not find anything about this topic on the documentation, I > =B4ve been rewieving some internal packages and the idea I had is this > one: > > << Utilities`URLTools` > > (*This is a failed link *) > Quiet[If[(ToString[Head[Utilities`URLTools`FetchURL["http://www.googeewrt= wertwetrerle23232.es/", "file.tmp"]]] == > "Symbol"), Print["Failed"], Print["Ok"]]]; > (*And this is a good one*) > Quiet[If[(ToString[ > Head[Utilities`URLTools`FetchURL["http://www.google.es/", > "file.tmp"]]] == "Symbol"), Print["Failed"], Print["Ok"]]] > > The idea is to use the FecthURL function that cames within the > "URLTools" package, but this way of doing this seems awful and this > function creates a temporary file that after all it is necessary to be > deleted. > > Does anybody knows the proper way to do this? > > Thanks in advance. > > Enrique.