session_start();
$user = wp_get_current_user();
$customer_id= $user->user_login;
$_SESSION[‘custID’] = $customer_id;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://df.hatchster.net/api/v2/pwa_live’);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’,’X-DreamFactory-Api-Key:4ba18da7d3d239fdb58aedd8f26236369289c58347443ef303e4a44c805fa07c’));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 40);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘{“module_name”:”get_duplicate_accounts”,”customer_id”:”‘.$customer_id.'”}’);
$result = curl_exec($ch);
curl_close($ch);

$responseAry = json_decode($result,1);
$resultAry = $responseAry[‘response’][0][‘get_duplicate_accounts’][‘response’];

$primary = $_SESSION[‘snapshot’][‘msn’];
$primary = str_pad(substr($primary, -3), strlen($primary), ‘*’, STR_PAD_LEFT);
$primaryMasked = str_replace(‘*’,”,$primary);
$email = $_SESSION[‘snapshot’][’email’];

$result = ”;
if(strtolower($resultAry[‘status’])==’success’) {
$status = ‘1’;
foreach($resultAry[‘msns’] as $MSN) {
if(is_array($MSN)){
$masked = str_replace(‘*’,”,$MSN[‘MSN’]);
$result .= ‘

‘.$MSN[‘MSN’].’ STOP ALL MERGE

‘;
} else {
$MSN = $resultAry[‘msns’][‘msns’];
$masked = str_replace(‘*’,”,$MSN[‘MSN’]);
$result .= ‘

‘.$MSN[‘MSN’].’ STOP ALL MERGE

‘;
break;
}
}
} else {
$status = ‘0’;
$result = ‘

There are no other accounts associated to this account.

‘;
}

echo ‘

‘;