예제 #1
0
function GetUserInfo($complex)
{
    global $soap;
    $soap = TRUE;
    $xmsUser = $complex->xmsUser;
    $xmsUser = str_replace("UTF-16", "UTF-8", $xmsUser);
    $return = '<?xml version="1.0" encoding="utf-16"?>' . "\n";
    try {
        $xml = new SimpleXMLElement($xmsUser);
        $user = $xml->userId;
        $pass = $xml->password;
        try {
            $gv = new GoogleVoice($user, $pass);
            $email = $user;
            $phone = $gv->get_number();
            $return .= '<userInfo xmlns="http://schemas.microsoft.com/office/Outlook/2006/OMS">';
            $return .= '<replyPhone>' . $phone . '</replyPhone>';
            $return .= '<smtpAddress>' . $email . '</smtpAddress>';
            $return .= '<error code="ok" severity="neutral" />';
            $return .= '</userInfo>';
        } catch (Exception $e) {
            $return .= '<userInfo xmlns="http://schemas.microsoft.com/office/Outlook/2006/OMS">';
            $return .= '<error code="invalidUser" severity="failure" />';
            $return .= '</userInfo>';
        }
    } catch (Exception $e) {
        $return .= '<userInfo xmlns="http://schemas.microsoft.com/office/Outlook/2006/OMS"><error code="invalidFormat" severity="failure" /></userInfo>';
    }
    return array("GetUserInfoResult" => $return);
}