I want to upload a csv file with multiple contacts using api or simple php example code. i have already try to upload api v1 and v2 but not any success. please find me any solution. i need api code or simple curl request in php.
Thanks for posting in the forums. We're going to be adding this to the documentation in the near future, but here's an example cURL request that will perform a contact upload:
curl -i -H "Authorization: Bearer <TOKEN>" -H "Content-Type: multipart/form-data" -H "Accept: application/json" -X POST -F 'lists=<LIST_ID(S)>' -F 'file_name=contacts.txt' -F 'column_names=EMAIL' -F 'firstname.lastname@example.org' "https://api.constantcontact.com/v2/activities/addcontacts?api_key=<API_KEY>";
This request implies that the file is in the same directory that the cURL request is run in, and that there is only one column of information. The file_name parameter should match the file pointed to in the data parameter. You can add column_names based on the listed parameters here:
Be sure to follow the other constraints specified by the documentation. I hope the information helps.
API Support, Constant Contact