Re: Test for valid URL?
Re: Test for valid URL?
- Subject: Re: Test for valid URL?
- From: Steve Thompson <email@hidden>
- Date: Thu, 16 Sep 2010 13:10:44 +0100
No, because a response from a server doesn't mean it's serving anything - just means it's on and has a valid network connection.
For example:
mini:~ steve$ ping -c1 Mx01.bis.eu.blackberry.com PING mx01.bis.eu.blackberry.com (216.9.253.32): 56 data bytes 64 bytes from 216.9.253.32: icmp_seq=0 ttl=240 time=102.340 ms
--- mx01.bis.eu.blackberry.com ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 102.340/102.340/102.340/0.000 ms
mini:~ steve$ curl -m10 Mx01.bis.eu.blackberry.com curl: (7) couldn't connect to host curl: (7) couldn't connect to host
It responds to ping but won't give me any data
Steve
On 16 Sep 2010, at 12:43, Alex Zavatone wrote: Could you do a shall script to ping it?On Sep 16, 2010, at 5:38 AM, Steve Thompson wrote: On 16 Sep 2010, at 01:48, Michael Grant wrote: Does AppleScript provide any way of testing whether a string is a valid URL before using it as the argument of the "open location" command? A couple of other people have mentioned that the word "valid" is ambiguous but for "standard" URLs this works
try on error display dialog "No a valid URL" end try
If curl can't resolve the url it returns an error which AppleScript's try statement can catch.
Steve
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden