Thank-you tachyon-II. I modified the code as you suggested.
I am seeing a bit more debug which leads me to believe this is an ssl issue.
Client-SSL-Warning: Peer certificate not verified
Title: Access Denied
Do you know how to code this so it works with ssl please?