全て、
しばらくの間、この問題を解決しようとしても何の進展もありませんでした... フィードバックは大歓迎です。
ユーザーの発信者 ID と YoB に基づく単純な認証を使用しています。ユーザーが一意の YoB を持っている場合、サービスにアクセスできます。その発信者 ID の下に同じ YoB を持つ別のユーザーがいる場合、追加情報が必要であるというメッセージが表示されます。
関数の目的は、一致するユーザーのレコードを返すことです。現時点では、常に最後のレコードを返します。
PHP コード:
// $response -> XML record with firstName, lastName and dob (dd/mm/yyyy)
// $yob -> YoB user has entered for authentication
function parseResponseYOB($response, $yob)
{
$duplicates = 0; // If there are users with same YoB, display message that additional info is required
if(empty($response->CallerMembers->CallerMemberDetails->dob))
{
$iterateArr = $response->CallerMembers->CallerMemberDetails;
}else{
$iterateArr[] = $response->CallerMembers->CallerMemberDetails;
}
foreach($iterateArr as $result)
{
$parseResult['firstName'] = $result->firstName;
$parseResult['lastName'] = $result->lastName;
$parseResult['yob'] = substr($result->dob, -4);
if($parseResult['yob'] == $yob)
{
$duplicates++;
}else{
continue;
}
}
// Check for duplicate YoBs
if($duplicates > 1)
{
return "Multiple members with the same YOB";
}elseif($duplicates < 1){
return "No members with the specified YOB found";
}
return $parseResult; // No duplicates, return the record of the matching user
// PROBLEM: Always the last record is returned... not the one with matching YOB?
}
}