BBEdit 8.0 -- A Developer's Viewpoint
Subject:   Open from URL...
Date:   2004-12-22 09:18:29
From:   leejoramo
I have been using the following AppleScript for a number of years. I mostly likely found it on the BBEdit mailing list. The advantage of this script over the one included in the article is that it lets you choose if you want to include the http headers, which can be useful.

property my_url : ""

tell application "BBEdit"
set my_result to display dialog ¬
"URL:" default answer my_url ¬
buttons {"Cancel", "With Headers", "Grab Source"} default button 3
set my_url to the text returned of my_result

if button returned of my_result is "With Headers" then
set my_text to do shell script ("curl -i " & my_url)
set my_text to do shell script ("curl " & my_url)
end if

make new text window with properties {contents:my_text, name:my_url}
select insertion point before character 1 of text window 1
end tell