ExistsURLQ
- To: mathgroup at smc.vnet.net
- Subject: [mg111634] ExistsURLQ
- From: E. Pérez Herrero <enriqueperezherrero at gmail.com>
- Date: Sun, 8 Aug 2010 07:21:47 -0400 (EDT)
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.googeewrtwertwetrerle23232.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.