I’m currently experiencing and issue in applescript with curl that when I start appending variables to the end of a url curl returns with a bad request error. The following code is the code in question (I commented so you can see what I am trying to do as I do it and the steps I have already tried):
--The following what and who variables are just an example, normally this information is retrieved from iTunes
set what to "Attack"
set who to "System Of A Down"
(*
if the following line is used instead I do get the TinyUrl, but notice I had to manually enter the search information
set FullURL to ("http://tinyurl.com/api-create.php?url=http://en.wikipedia.org/wiki/Special:Search?search=Attack+by+System+of+a+down/")
*)
set FullURL to ("http://tinyurl.com/api-create.php?url=http://en.wikipedia.org/wiki/Special:Search?search=" & what & "+by+" & who & "/")
do shell script "curl '" & FullURL & "' | vis"
set tinyurl to result
--what is the URL?
display dialog FullURL
--the adding the URL to the clipboard was only for debugging. The URL does successfully load in Browser
tell application "Finder" to set the clipboard to the searchFullURL as text
--this is the error I receive
display dialog tinyurl
I imagine it is something trivial like a misplaced quotation mark. But I have looked at it for upwards of an hour and don’t see what is wrong.