title: Updating subscribers in a list using cURL and Mailchimp API v3
body: <p>I have this code below that adds a user to a pre-existing list in Mailchimp.</p>
  
  <pre><code>$apikey = '&lt;api_key&gt;';
          $auth = base64_encode( 'user:'.$apikey );
  
          $data = array(
              'apikey'        =&gt; $apikey,
              'email_address' =&gt; $email,
              'status'        =&gt; 'subscribed',
              'merge_fields'  =&gt; array(
                  'FNAME' =&gt; $name
              )
          );
          $json_data = json_encode($data);
  
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, 'https://us2.api.mailchimp.com/3.0/lists/&lt;list_id&gt;/members/');
          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_TIMEOUT, 10);
          curl_setopt($ch, CURLOPT_POST, true);
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);                                                                                                                  
  
          $result = curl_exec($ch);
  
          var_dump($result);
          die('Mailchimp executed');
  </code></pre>
  
  <p>This code only adds users to the list and when I try add the details of the same user twice it throws the following error on the second attempt:</p>
  
  <blockquote>
    <p>test@user.com is already a list member. Use PATCH to update existing members.</p>
  </blockquote>
  
  <p>How do I go about using PATCH to update user details? I'm not sure where to specify it.</p>