Update Subscriber (put)
Update Subscriber (put) | Update a subscriber.
<?php //example PHP code to update a subscriber //set values of person to update $put_params['apiKey']="APIKEY_HERE"; $put_params['id']="SUBSCRIBERID_HERE"; //Optional fields commented out below: //$put_params['email']="example@email.com"; //listId can be one listid, or for multiple lists, pass a comma-delimimted list of listIds //$put_params['listId']="1"; //$put_params['listId']="1,2,3,4"; //$put_params['firstname']="FIRSTNAME_HERE"; //$put_params['lastname']="LASTNAME_HERE"; //$put_params['mobile_phone']="9999999999"; //$put_params['email_type']="1"; //$put_params['unsubscribe']="0"; //$put_params['sms_unsubscribe']="0"; //$put_params['customfields']='{"custom1": "CUSTOMFIELD_VALUE_HERE", "custom2": "CUSTOMFIELD_VALUE_HERE"}'; $url = 'http://apidomain.com/api2/subscriber'; //Puts this using CURL $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 100); curl_setopt($curl, CURLOPT_POSTFIELDS,http_build_query($put_params)); $result = curl_exec ($curl); curl_close ($curl); echo $result; //Parse the json to get return values. $parsed_result = json_decode($result,false); echo "<br><br>Status: $parsed_result->status"; echo "<br>Message: $parsed_result->message"; echo "<br>Error Code: $parsed_result->errorcode"; echo "<br>Error Message: $parsed_result->errormessage"; echo "<br>Subscriber Id: "; echo $parsed_result->data->id; echo "<br>Subscriber Email:"; echo $parsed_result->data->email; echo "<br>Subscriber First Name:"; echo $parsed_result->data->firstname; ?>