script curl
on retrieve(x)
return (do shell script "curl -s -S " & x) as string
end retrieve
on retrievepro(x, i)
return (do shell script "curl -s -S " & i & space & quoted form of x) as string
end retrievepro
on post(x, i)
return (do shell script "curl -s -S -d \"" & i & "\" " & quoted form of x) as string
end post
end script
curl's retrieve("http://www.google.com/")
Hello
I guess you want to get the output And want to check if there was an error of the curl command.
I have understood it that curl returns 0 when there is no error as every sane shell command, except true.
I propose that you collect the output of the curl command and “echo $?” in a subshell to gather all the output in result:
set theResult to do shell script "(" & yourCurlCommand & " ; echo $? )"
set errorcode to last paragraph of theResult as number
if errorcode is not 0 then
..
end if