Handling errors in curl connection and implementing version constant