I am pulling my hair out trying to figure out the proper syntax for a do shell script with curl to access an ftp site where the user name is somebody@test.com…
when i try
set result to do shell script “curl -l ftp://somebody@test.com:testing@some.ftp.site”
I get a problem with the resolving of the ftp site…i believe it is the @ sign in the email address…
any ideas? BTW I have searched the site to try to find an answer…thanks
Thanks for the reply. Unfortunately the site we are trying to access does not give us the option of choosing our username. We are stuck with email addresses. Oh well, maybe curl isn’t the answer.
I think you need to URL encode the username. In this case you need to replace the @ in the username with %40
some brief code to get URL encoded text:
set textToEncode to "somebody@test.com"
do shell script "python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of textToEncode
--> "somebody%40test.com"
set result to do shell script "curl -l ftp://somebody\@test.com:testing@some.ftp.site"
You may need more than one escape to get it from AppleScript to the shell in the above form. I would expect that the ftp server you are using is seeing the @ sign and interpreting that as a delimiter and not a character in the username.
Cheers.
Edited to add: You don’t mention if this works straight from the command line. I alway try to get that working first, then I know better how to set up the AppleScript. -HTH.
Hi,
Thanks everyone for all their help. I worked at it from the command line as was suggested and found the problem. The correct terminology i needed for curl was
the problem ended up being the EPSV parameter, which I hadn’t used previously…I was able to see what was going on thru curl at the command line by adding the -v (verbose) parameter and saw the EPSV problem…all good here now…Thanks again. BTW This worked without URL encoding the @ sign in the username…go figure