Ahmed,

A 401 is typically returned when you are not properly authenticated.
Are you sure that your credentials are valid?
You may consider printing out the full response:

...

} catch (Zend_Gdata_App_HttpException $httpException) {

    print 'ERROR : '. $httpException->getMessage()  .
                    ' HTTP details <br />' .
                    ($httpClient->getLastResponse() ?
$httpClient->getLastResponse()->getBody() : 'No response from the
server');


  // if there is no specific HttpException,

  // then just examine the regular exception

} catch (Zend_Gdata_App_Exception $e) {

    echo $e->getMessage()."<hr>";
}



On Fri, Jun 27, 2008 at 8:00 PM, Ahmed Abdel-Aliem <[EMAIL PROTECTED]> wrote:
> hi all,
> i am running the below code to retrieve list of calendars from google
> calendar, but when i run it i get this error :
>
> Error: Expected response code 200, got 401
>
> here is the code :
>
> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> $email = '[EMAIL PROTECTED]';
> $passwd = 'xxxxxxxxxx';
> try {
>    $client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd);
> } catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
>     echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n";
>     echo 'Token ID: ' . $cre->getCaptchaToken() . "\n";
> } catch (Zend_Gdata_App_AuthException $ae) {
>    echo 'Problem authenticating: ' . $ae->getMessage() . "\n";
> }
> $service = new Zend_Gdata_Calendar($client);
>
> try {
>     $listFeed= $service->getCalendarListFeed();
> } catch (Zend_Gdata_App_Exception $e) {
>     echo "Error: " . $e->getMessage();
> }
> echo "<h1>Calendar List Feed</h1>";
> echo "<ul>";
> foreach ($listFeed as $calendar) {
>     echo "<li>" . $calendar->title . " (Event Feed: " . $calendar->id .
> ")</li>";
> }
> echo "</ul>";
>
> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> anybody can help me with that ??
>
> thanks in advance.
>
> --
> Ahmed Abdel-Aliem

Reply via email to