problem with curl passing arguments

Hi all,

Here is my script:

tell application "Finder"
	set jobnum to "12345"
	set imageVersion to "3"
	set curlURL to "curl [url=http://www.mysite.com/changestatus.taf?j=]http://www.mysite.com/changestatus.taf?j="[/url] & jobnum & "&v=" & imageVersion
	do shell script curlURL
end tell

Seems to work fine, except that the imageVersion argument is not being passed to my web server.

What I want to web server to receive is this:
http://www.mysite.com/changestatus.taf?j=12345&v=3

But, apparently, the web server is receiving something like this:
http://www.mysite.com/changestatus.taf?j=12345

If I use “open location” to pass the URL, everything works fine, but this script will be running on a black box machine, so I don’t want to keep opening and closing browser windows if I don’t have to.

Any thoughts?

Thanks for your help.

First, your don’t need the Finder to do a shell script. Second, you could try using the quoted form of the URL.

set jobnum to "12345"
set imageVersion to "3"
get quoted form of ("http://www.mysite.com/changestatus.taf?j=" & jobnum & "&v=" & imageVersion)
do shell script "curl " & result

I’m having this issue at the moment as well. There seems to be a problem with curl escaping the amperstand (&).

WIth it (&), script editor hangs while calling curl. with the quoted form, it just gets the wrong page. any other idea s of how to escape “&” in a constructed URL without using quoted form of?

Thanks.


property tmbase : "http://www.ticketmaster.com/find_area?area="
property tmsuff : "&Submit=Go"
property acity : "new+york"

set theURL to (tmbase & acity & tmsuff)
-- above will cause curl to hang script editor
set the_quoted_URL to quoted form of (tmbase & acity & tmsuff)
-- above will get the wrong page
set thesearch to "summary=\"Hot Tickets\""
-- resulting page (r) should contain < summary="Hot Tickets" > 
set r to do shell script ("curl " & the_quoted_URL)

if r contains thesearch then
	log "Success"
else
	log "Failure"
end if

open location theURL -- this is correct page

When I visit this directly.

. I get redirected to the Ticketmaster home page. This is probably because the website is not getting all the information it expects or that particular URL not longer exists.

Yes, the URL is resolved to the Ticketmaster home page. But at least for me the page contents properly shows the information for “new york”. Try any other area (city with + instead of space) and it should work too. for example:

http://www.ticketmaster.com/find_area?area=detroit&Submit=Go

(note this only works for unique cities – still checking out a way to deal with non-unique ones)

But as far as the quoting issue above, I believe it still stands. Thanks.