Subscribers File Import (post)
Subscribers File Import (post) | Subscribers bulk insert.
<?php //example PHP code to import subscribers from file //set values for import $post_params['apiKey']="APIKEY_HERE"; $post_params['listId']="LISTID_HERE"; $post_params['mapfields']="email,custom1"; $post_params['file'] = "@/path/to/myfile.txt"; //Optional fields commented out below: //$post_params['fileDelimiter']="csv"; //$post_params['conflicts']="1"; //$post_params['unsubscribe']="0"; $url = 'http://apidomain.com/api2/subscribers'; //Posts this using CURL $curl = curl_init($url); curl_setopt ($curl, CURLOPT_POST, 1); curl_setopt ($curl, CURLOPT_POSTFIELDS, $post_params); curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 100); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $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"; ?>