title: MailChimp integration Error code 501 - Unsupported request - PHP
body: <p>Below is my code to add contact to the mailchimp. I am getting mailchimp api key and list id from the env file in laravel. Also $data involves all the input.</p>
  <pre><code>        $apiKey = env('MAILCHIMP_APIKEY');
          $listId = env('MAILCHIMP_LIST_ID');
          $auth = base64_encode( 'user:'.$apiKey);
  
          $mailChimpdata = array(
              'apikey'        =&gt; $apiKey,
              'email_address' =&gt; $data['email'],
              'status'        =&gt; $data['status'],
              'merge_fields'  =&gt; array(
                  'FNAME'     =&gt; $data['firstname'],
                  'LNAME'     =&gt; $data['lastname']
              )
          );
  
          $json_data = json_encode($mailChimpdata);
  
          $ch = curl_init();
          $memberId = md5(strtolower($data['email']));
        
          $url = 'https://us19.admin.mailchimp.com/3.0/lists/' . $listId . '/members/' . $memberId; 
          curl_setopt($ch, CURLOPT_URL, $url);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Basic '.$auth));
          curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_VERBOSE, true);
          curl_setopt($ch, CURLOPT_HEADER, true);
          curl_setopt($ch, CURLOPT_TIMEOUT, 10);
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
          curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
          curl_setopt($ch, CURLOPT_POST, true);       
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
          curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
  
          $result = curl_exec($ch);
  </code></pre>
  <p>But I am getting this below error</p>
  <pre><code>HTTP/1.0 501 Not Implemented
  Server: AkamaiGHost
  Mime-Version: 1.0
  Content-Type: text/html
  Content-Length: 334
  Expires: Wed, 07 Apr 2021 08:49:45 GMT
  Date: Wed, 07 Apr 2021 08:49:45 GMT
  Connection: close
  Set-Cookie: _abck=471ED28A26F6757CE57AC9E4318E7BD6~-1~YAAQHdcLF/keKqt4AQAASPOFqwWS/EeAKXso+2igviRTfIMw3pqbDMndhfZPfoX+eQn3Iv8iqfbogtNFmkU4lRDRQLdAWAYBhq2oOhDTiK ▶
  Set-Cookie: bm_sz=5CBD698E96AC9E2B62898990FF45E196~YAAQHdcLF/oeKqt4AQAASPOFqwsLVm8fKmxtToeWU99vCUWske+XMuRtEjiCpzXhPE5xe8jGoh6EfYe8WG6zjMaaI2jPZos0gb2ER9jykveOE ▶
  
  &lt;HTML&gt;&lt;HEAD&gt;
  &lt;TITLE&gt;Unsupported Request&lt;/TITLE&gt;
  &lt;/HEAD&gt;&lt;BODY&gt;
  &lt;H1&gt;Unsupported Request&lt;/H1&gt;
  PUT to http&amp;#58;&amp;#47;&amp;#47;us19&amp;#46;admin&amp;#46;mailchimp&amp;#46;com&amp;#47;3&amp;#46;0&amp;#47;lists&amp;#47;applevendor&amp;#47;members&amp;#47;b642b4217b34b1e8d3bd915fc65c4452 not supported.&lt;P&gt; 
  Reference&amp;#32;&amp;#35;8&amp;#46;1dd70b17&amp;#46;1617785385&amp;#46;68d39e
  &lt;/BODY&gt;&lt;/HTML&gt;
  </code></pre>
  <p>Please help me out to resolve this issue.</p>