Update lib.inc.php

- prevent curl ssl error when hostname of URL doesn't match hostname of certificate
- provide more errorinformation when curl fails