Use curl before fopen, make existence cacert a condition