• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: extract URL from general text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extract URL from general text


  • Subject: Re: extract URL from general text
  • From: Doug McNutt <email@hidden>
  • Date: Wed, 19 Mar 2008 15:22:23 -0600

At 13:48 -0700 3/19/08, Rainer Standke wrote:
>Hmm. 'curl -O http://www.apple.com' yields 'curl: Remote file name has  no length!' for some reason.
>
>However, I am wondering if curl could help turning an AS alias into a  file URL. I have repeatedly looked at the curl man page, but nothing  reveals itself to me. Am I barking up the wrong tree?

curl uses the -O (capital) option to create a name for the file to be downloaded locally as the remaining text after the last / in the current working directory.  "www.apple.com" depends on apache or another HTTP server to find something like "index.html" in the directory pointed to and curl doesn't know that.

curl -o $HOME/Apple.html  http://www.apple.com'

will work, placing the download in your home directory under the name Apple.html. Note the lower case -o.

If curl fails it returns a variety of things that you can ask for. You probably want the result code of the operation and I think there's a way to do that with do_shell_script. The option sequence -o /dev/null is conceivable but a bit silly. With neither -o nor -O the download is written to stdout.

curl is an open source Unix/Linux/BSD offering which has no knowledge of Apple's alias mechanism I believe it will follow links, either symbolic or hard, on the local system.. The -L option will allow for HTTP indirects.

But if all you want to do is check for validity of a DNS name you can use the UNIX tool dig. It's a replacement for nslookup which may still be present but is deprecated.

man dig

tells all, but there is a learning curve there.
--

--> From the U S of A, the only socialist country that refuses to admit it. <--
 _______________________________________________
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

References: 
 >Re: extract URL from general text (From: "Gary (Lists)" <email@hidden>)
 >Re: extract URL from general text (From: Rainer Standke <email@hidden>)

  • Prev by Date: Re: extract URL from general text
  • Next by Date: Re: applications launch invisibly in 10.5?
  • Previous by thread: Re: extract URL from general text
  • Next by thread: Re: extract URL from general text
  • Index(es):
    • Date
    • Thread