当前位置: 首页>>代码示例>>PHP>>正文


PHP getClientLoginHttpClient函数代码示例

本文整理汇总了PHP中getClientLoginHttpClient函数的典型用法代码示例。如果您正苦于以下问题:PHP getClientLoginHttpClient函数的具体用法?PHP getClientLoginHttpClient怎么用?PHP getClientLoginHttpClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getClientLoginHttpClient函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getClientLoginHttpClient

 *
 * @param  string $user The username, in e-mail address format, to authenticate
 * @param  string $pass The password for the user specified
 * @return Zend_Http_Client
 */
function getClientLoginHttpClient($user, $pass)
{
    $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
    $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
    return $client;
}
/**
 * Outputs an HTML unordered list (ul), with each list item representing a
 * calendar in the authenticated user's calendar list.
 *
 * @param  Zend_Http_Client $client The authenticated client object
 * @return void
 */
function outputCalendarList($client)
{
    $gdataCal = new Zend_Gdata_Calendar($client);
    $calFeed = $gdataCal->getCalendarListFeed();
    echo "<h1>" . $calFeed->title->text . "</h1>\n";
    echo "<ul>\n";
    foreach ($calFeed as $calendar) {
        echo "\t<li>" . $calendar->title->text . "</li>\n";
    }
    echo "</ul>\n";
}
$client = getClientLoginHttpClient("contact.cs50organizations@gmail.com", "crimsongroups");
$_SESSION["client"] = $client;
开发者ID:ramyarangan,项目名称:CS50Organizations,代码行数:31,代码来源:calendarSetup.php

示例2: deleteAtomEntryById

                deleteAtomEntryById($client, $argv[4]);
            } else {
                echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " . "<eventId>\n";
            }
            break;
        case 'deleteAtomEntryByUrl':
            if ($argc == 5) {
                $client = getClientLoginHttpClient($argv[2], $argv[3]);
                deleteAtomEntryByUrl($client, $argv[4]);
            } else {
                echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " . "<eventUrl>\n";
            }
            break;
        case 'createEvent':
            if ($argc == 12) {
                $client = getClientLoginHttpClient($argv[2], $argv[3]);
                createEvent($client, $argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9], $argv[10], $argv[11]);
            } else {
                echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " . "<title> <description> <where> " . "<startDate> <startTime> <endDate> <endTime> <tzOffset>\n";
                echo "EXAMPLE: php {$argv[0]} {$argv[1]} <username> <password> " . "'Tennis with Beth' 'Meet for a quick lesson' 'On the courts' " . "'2008-01-01' '10:00' '2008-01-01' '11:00' '-08'\n";
            }
            break;
    }
} else {
    if (!isset($_SERVER["HTTP_HOST"])) {
        // running from command line, but action left unspecified
        echo "Usage: php {$argv[0]} <action> [<username>] [<password>] " . "[<arg1> <arg2> ...]\n\n";
        echo "Possible action values include:\n" . "outputCalendar\n" . "outputCalendarMagicCookie\n" . "outputCalendarByDateRange\n" . "outputCalendarList\n" . "updateAtomEntry\n" . "deleteAtomEntryById\n" . "deleteAtomEntryByUrl\n" . "createEvent\n";
    } else {
        // running through web server - demonstrate AuthSub
        processPageLoad();
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:Calendar-expanded.php

示例3: runWWWVersion

/**
 * Processes loading of this sample code through a web browser.
 *
 * @return void
 */
function runWWWVersion()
{
    session_start();
    // Note that all calls to endHTML() below end script execution!
    // Check to make sure that the user has set a password.
    $p = LOGIN_PASSWORD;
    if (empty($p)) {
        startHTML(false);
        displayPasswordNotSetNotice();
        endHTML();
    }
    // Grab any login credentials that might be waiting in the request
    if (!empty($_POST['password'])) {
        if ($_POST['password'] == LOGIN_PASSWORD) {
            $_SESSION['authenticated'] = 'true';
        } else {
            // Invalid password. Stop and display a login screen.
            startHTML(false);
            requestUserLogin("Incorrect password.");
            endHTML();
        }
    }
    // If the user isn't authenticated, display a login screen
    if (!isset($_SESSION['authenticated'])) {
        startHTML(false);
        requestUserLogin();
        endHTML();
    }
    // Try to login. If login fails, log the user out and display an
    // error message.
    try {
        $client = getClientLoginHttpClient(GAPPS_USERNAME . '@' . GAPPS_DOMAIN, GAPPS_PASSWORD);
        $gapps = new Zend_Gdata_Gapps($client, GAPPS_DOMAIN);
    } catch (Zend_Gdata_App_AuthException $e) {
        session_destroy();
        startHTML(false);
        displayAuthenticationFailedNotice();
        endHTML();
    }
    // Success! We're logged in.
    // First we check for commands that can be submitted either though
    // POST or GET (they don't make any changes).
    if (!empty($_REQUEST['command'])) {
        switch ($_REQUEST['command']) {
            case 'retrieveUser':
                startHTML();
                retrieveUser($gapps, true, $_REQUEST['user']);
                endHTML(true);
            case 'retrieveAllUsers':
                startHTML();
                retrieveAllUsers($gapps, true);
                endHTML(true);
            case 'retrieveNickname':
                startHTML();
                retrieveNickname($gapps, true, $_REQUEST['nickname']);
                endHTML(true);
            case 'retrieveNicknames':
                startHTML();
                retrieveNicknames($gapps, true, $_REQUEST['user']);
                endHTML(true);
            case 'retrieveAllNicknames':
                startHTML();
                retrieveAllNicknames($gapps, true);
                endHTML(true);
            case 'retrieveEmailLists':
                startHTML();
                retrieveEmailLists($gapps, true, $_REQUEST['recipient']);
                endHTML(true);
            case 'retrieveAllEmailLists':
                startHTML();
                retrieveAllEmailLists($gapps, true);
                endHTML(true);
            case 'retrieveAllRecipients':
                startHTML();
                retrieveAllRecipients($gapps, true, $_REQUEST['emailList']);
                endHTML(true);
        }
    }
    // Now we handle the potentially destructive commands, which have to
    // be submitted by POST only.
    if (!empty($_POST['command'])) {
        switch ($_POST['command']) {
            case 'createUser':
                startHTML();
                createUser($gapps, true, $_POST['user'], $_POST['givenName'], $_POST['familyName'], $_POST['pass']);
                endHTML(true);
            case 'updateUserName':
                startHTML();
                updateUserName($gapps, true, $_POST['user'], $_POST['givenName'], $_POST['familyName']);
                endHTML(true);
            case 'updateUserPassword':
                startHTML();
                updateUserPassword($gapps, true, $_POST['user'], $_POST['pass']);
                endHTML(true);
            case 'setUserSuspended':
//.........这里部分代码省略.........
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:101,代码来源:Gapps.php

示例4: runCLIVersion

/**
 * Parse command line arguments and execute appropriate function when
 * running from the command line.
 *
 * If no arguments are provided, usage information will be provided.
 *
 * @param array $argv The array of command line arguments provided by PHP.
 *          $argv[0] should be the current executable name or '-' if
 *          not available.
 * @param int $argc The size of $argv.
 */
function runCLIVersion($argv, $argc)
{
    if (isset($argc) && $argc >= 2) {
        # Prepare a server connection
        if ($argc >= 4) {
            try {
                $client = getClientLoginHttpClient($argv[2], $argv[3]);
                $docs = new Zend_Gdata_Docs($client);
            } catch (Zend_Gdata_App_AuthException $e) {
                echo "Error: Unable to authenticate. Please check your";
                echo " credentials.\n";
                exit(1);
            }
        }

        # Dispatch arguments to the desired method
        switch ($argv[1]) {
            case 'retrieveAllDocuments':
                if ($argc >= 4) {
                    retrieveAllDocuments($docs, false);
                } else {
                    echo "Usage: php {$argv[0]} {$argv[1]} <username>";
                    echo " <password>\n\n";
                    echo "This lists all of the documents in the user's";
                    echo " account.\n";
                }
                break;
            case 'retrieveWPDocs':
                if ($argc >= 4) {
                    //echo "!WP Docs:";
                    //var_dump($docs);
                    retrieveWPDocs($docs, false);
                } else {
                    echo "Usage: php {$argv[0]} {$argv[1]} <username>";
                    echo " <password>\n\n";
                    echo "This lists all of the word processing documents in";
                    echo " the user's account.\n";
                }
                break;
            case 'retrieveSpreadsheets':
                if ($argc >= 4) {
                    retrieveAllDocuments($docs, false);
                } else {
                    echo "Usage: php {$argv[0]} {$argv[1]} <username>";
                    echo " <password>\n\n";
                    echo "This lists all of the spreadsheets in the user's";
                    echo " account.\n";
                }
                break;
            case 'fullTextSearch':
                if ($argc >= 4) {
                    // Combine all of the query args into one query string. 
                    // The command line split the query string on space 
                    // characters.
                    $queryString = implode(' ', array_slice($argv, 4));
                    fullTextSearch($docs, false, $queryString);
                } else {
                    echo "Usage: php {$argv[0]} {$argv[1]} <username>";
                    echo " <password> <query string>\n\n";
                    echo "This lists all of the documents which contain the";
                    echo " query string.\n";
                }
                break;
            case 'uploadDocument':
                if ($argc >= 5) {
                    // Pass in the file name of the document to be uploaded. 
                    // Since the document is on this machine, we  do not need
                    // to set the temporary file name. The temp file name is
                    // used only when uploading to a webserver.
                    uploadDocument($docs, false, $argv[4], null);
                } else {
                    echo "Usage: php {$argv[0]} {$argv[1]} <username>";
                    echo " <password> <file_with_path>\n\n";
                    echo "This lists all of the documents which contain the";
                    echo " query string.\n";
                    echo "\nExample: php {$argv[0]} {$argv[1]} <username>";
                    echo " <password> /tmp/testSpreadsheet.ods\n";
                }
                break;
            default:
                // Invalid action entered
                displayHelp($argv[0]);
        // End switch block
        }
    } else {
        // action left unspecified
        displayHelp($argv[0]);
    }
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:100,代码来源:Docs.php

示例5: onAddEntry

 function onAddEntry($data)
 {
     createEvent(getClientLoginHttpClient("aglcarrilanas@gmail.com", "noviembre11"), $data['nombre'], "Carrera normal", $data['lugar'], $data['fecha'], '00:00', $data['fecha'], '23:59', '+01');
 }
开发者ID:RamonCidL,项目名称:Carrilanas,代码行数:4,代码来源:CarreraConInscripciones.php


注:本文中的getClientLoginHttpClient函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。