add jshon check,ssl cert opt

I added '-k' option to curl command and '-c' opt to script.

"if[ $i -ne 0 ]" not worked for me(3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux)