<!-- Intent: updates the given contact on the contact list with listcode of 123456
	-->


<?php
$url = 'http://api.v4.swiftreach.com/api/ContactLists/Contacts/Update/123456/736c8340-e23b-4c23-aaa1-f55cfdb391bb';
$authToken = '123456';



$jsonString = ' 
{ 
	"EntityName":"MyContact JSON 0", 
	"EntityGuid":"736c8340-e23b-4c23-aaa1-f55cfdb391bb", 
	"Phones":[{ 
		"Phone":"2012361344", 
		"Extension":"", 
		"AnsDetectionOverride":0, 
		"OptInSMS":true, 
		"PhoneType":0, 
		"PhoneLabel":"Mobile" 
		}], 
	"Addresses":[{ 
		"AddressGuid":"b414c9e2-4501-4ab8-9dd1-4fa11ba58761", 
		"Label":"Office", 
		"Address1":"14 Industrial Ave", 
		"Address2":"", 
		"City":"Mahwah", 
		"State":"NJ", 
		"PostalCode":"07430", 
		"County":"", 
		"Latitude":41.052698269486427, 
		"Longitude":-74.121656566858292, 
		"IsPrimary":true 
		}], 
	"Email":"info@swiftreach.com", 
	"Fax":"", 
	"SMSPhone":"", 
	"SMSNetwork":0, 
	"Pager":"", 
	"PagerNetwork":0, 
	"PinCode":"", 
	"SpokenLanguage":"English", 
	"Tag":"", 
	"UserDefined":[] 
}';


$headers = array(
    'Content-type: application/json',
    'SwiftAPI-Key: ' . $authToken,
    'Accept: application/json',
    'Expect:'
);
$ch = curl_init();
$args = array(
    CURLOPT_URL => $url,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => $jsonString,
    CURLOPT_HTTPHEADER => $headers,
);
curl_setopt_array($ch, $args);
$res = curl_exec($ch);
$res_data = json_decode($res, true);
print($res_data);
?>

<!-- example return value -->
0