Пример #1
0
}
try {
    if (isset($opts['url']) && $opts['url']) {
        $url = $opts['url'];
    } else {
        $url = API_ENDPOINT_URL;
    }
    echo "Instantiating client ({$url})... \n";
    $fuze = new Fuze_Client($url, $opts['pkey'], $opts['ekey']);
    echo "Checking keys ... ";
    $keysOk = $fuze->checkKeys();
    echo ($keysOk ? 'passed.' : 'failed!') . "\n";
    if (!$keysOk) {
        exit(1);
    }
    echo "Signing in with user account ... \n";
    $result = $fuze->signin(array('email' => $opts['email'], 'password' => $opts['password']));
    // The client should be signed in here, $fuze->isSignedIn() must be true
    if (!$fuze->isSignedIn()) {
        echo "Signing in failed! See signin result below:\n";
        var_dump($result);
        exit(1);
    }
    $fname = isset($opts['file-name']) && $opts['file-name'] ? $opts['file-name'] : null;
    $meeting_id = isset($opts['meeting-id']) && $opts['meeting-id'] ? $opts['meeting-id'] : null;
    $res = $fuze->uploadMedia($filePathName, $fname, $meeting_id);
    echo "Media uploaded. ID: {$res['mediaId']} (code: {$res['code']})\n";
} catch (Exception $e) {
    echo "An error occurred: {$e->getMessage()}\n";
    exit(1);
}