I do have a (basic) questions which is related to php and the handling of arrays:
I am writing a php function with the input "UserID" and the output should be"UserEmail" as an output.
From the API I am using and the output is an ARRAY:
Code: Select all
GetUserData()
get user data (UserLogin, UserFirstname, UserLastname, UserEmail, ...)
my %User = $UserObject->GetUserData(
UserID => 123,
Cached => 1, # not required -> 0|1 (default 0)
);
Code: Select all
<?PHP
$user = "xxx";
$pass = "xxx";
$client = new SoapClient(null, array('location' => "http://xxx.xxx.xx/otrs/rpc.pl",
'uri' => "Core",
'trace' => 1,
'login' => $user,
'password' => $pass,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED));
try {
$result = $client->__soapCall("Dispatch", array($user, $pass, "UserObject", "GetUserData", "UserID" , 2));
} catch (SoapFault $fault) {
echo "REQUEST:\n".$client->__getLastRequest()."\n";
echo "RESPONSE:\n".$client->__getLastResponse()."\n";
echo "</pre>";
exit;
}
#echo "REQUEST:\n".$client->__getLastRequest()."\n";
echo "RESPONSE:\n".$client->__getLastResponse()."\n\n";
var_dump($result);
?>
Code: Select all
RESPONSE:
OutOfOffice0ValidID1UserRefreshTime0UserCommentOutOfOfficeStartMonth1UserEmailx.xxx@xxx.xxUserTicketOverviewAgentTicketQueuePreviewUserThemeStandardUserID2.......................
array
's-gensym3' => string 'OutOfOffice' (length=11)
's-gensym5' => int 0
's-gensym7' => string 'ValidID' (length=7)
's-gensym9' => int 1
's-gensym11' => string 'UserRefreshTime' (length=15)
's-gensym13' => int 0
's-gensym15' => string 'UserComment' (length=11)
's-gensym17' => string '' (length=0)
's-gensym19' => string 'OutOfOfficeStartMonth' (length=21)
's-gensym21' => int 1
's-gensym23' => string 'UserEmail' (length=9)
's-gensym25' => string 'x.xxx@xxx.xx' (length=21)
's-gensym27' => string 'UserTicketOverviewAgentTicketQueue' (length=34)
's-gensym29' => string 'Preview' (length=7)
's-gensym31' => string 'UserTheme' (length=9)
's-gensym33' => string 'Standard' (length=8)
's-gensym35' => string 'UserID' (length=6)
's-gensym37' => int 2
............
So perhaps somebody is out there who can give a hint to solve this basic problem.
Thank you!