Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is curl installed on Lion by default?

HI


I am having a real job trying to get cURL to work in an apple script in Lion. A number of people have posted an Apple script so you can dial numbers throughyour phone extention on a Snom phone. Where as it worked onLeopard it now wont work on Lion and I cant work out why. The only thing I can think of is that cURL isnot installed by default can any one help?


The section of code I know NOT be working (I'v tested the rest). Its part of a perform action . The expression

set errorCode to do shell script "curl \"" & theURL & "\"" seems to do nothing.



set theURL to "http://" & mySnomLogin & ":" & mySnomPassword & "@"

set theURL to theURL & mySnomPhoneAddress & "/command.htm?number=" & cleanedNumber


-- Use curl to hit the URL and dial the number

set errorCode to do shell script "curl \"" & theURL & "\""


beep

display dialog "Info: Dialing " & numToDial buttons {"OK"}


--If there was an error, return a message.

if (characters 1 thru 3 of errorCode) as string is not equal to "000" then

display dialog "Error: " & errorCode buttons {"OK"}

end if



Thanks D

Posted on Apr 10, 2012 5:58 PM

Reply
9 replies

Apr 10, 2012 7:22 PM in response to Donald Collier1

That would be a very easy thing for you to check out, no? Just open a terminal and type curl. What happens?


(to save you the suspense I'll tell you, it's there)


What error messages are you getting? What is happening that makes you think the curl command isn;t working?

Have you tried putting in some print or log statments to tey and see what is going on?

Apr 11, 2012 12:32 AM in response to Frank Caggiano

Thanks This is the result I get :-


curl: try 'curl --help' or 'curl --manual' for more information



"Curl --Manual" does provide the manual so that is there


I get appropriate responce's from the script parts before the extract I have posted above. I have put in an eco command and I have commented out the "if" to see the "error" always but it does not even beep so something defiantly appears wrong with the line or the outcome:

set errorCode to do shell script "curl \"" & theURL & "\""


hence my wondering if cURL had been installed.


You can find the full script in template form here

Apr 11, 2012 6:25 AM in response to Donald Collier1

Nothing obviously wrong with the script. When you run the script does it hang or complete and your phone isn't dialed? If so does the errorCode have anything in it?


Unfortunately there is no way for me to run this without dialing your phone so troubleshooting it is difficult.


As Barney suggested what happens if you run curl from the command line? I can tell you that curl in Lion works as I have a few scripts that make use of it and they work.

Apr 11, 2012 8:47 AM in response to Donald Collier1

Barney's suggestion will probably show you the problem, which I suspect is a certificate verification problem.


The 'curl' shipped with Lion has https support that requires server certificates to verify correctly using the default CA trust settings OR using a CA database you provide it ('man curl' for details) OR trusting all certs if you give it the -k or --insecure arguments.


Also note that unlike an actual shell script, the AppleScript 'do shell script' function returns the output of the shell commands it is given *NOT THE RETURN VALUE* It also does not return diagnostic output that sent to the "standard error" stream. That's why running your command in a real shell is going to tell you more.


Message was edited by: billcole added last paragraph.

Apr 14, 2012 2:43 AM in response to billcole

Thank you all for your help.


Barney-1SE suggestion use terminal and billcole comments on certificates that helped pave the way.


In the end it was to do with the browser caching the password for the phone so it used that, hiding the fact that we had put the wrong password ( but still a valid password for that phone) into the script!


SNOM phones are really great but they have loads of different passwords!!

Is curl installed on Lion by default?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.