Hello! Thanks for your apport!
While i was debugging the code. I get notice that there is missing a dot between the server and api in the CURLOPT_URL in every method you call.
I believe it must be.
https://'.$server.'.api.mailchimp.com/3.0/lists/'.$list_id.'/members/
Greetings!