1

プライベート URL を使用して Google カレンダーからイベントの配列を取得しようとしています。Google APIドキュメントを読みましたが、最終的なサーバーファイル構造が何であるかがわからず、他の人にコードを編集させないようにするため、ZENDライブラリを使用せずにこれを試してみたいと思います.

また、投稿する前に検索を行ったところ、PHP CURL_EXEC が URL で false を返すという同じ状態に遭遇しましたが、URL が Web ブラウザーを使用して開かれている場合は JSON ファイルを取得します。プライベート URL を使用しているので、ZEND を使用して Google サーバーに対して認証する必要は本当にありますか? Flash用にエンコードする前に、PHPに配列をクリーンアップさせようとしています。

$URL = <string of the private URL from Google Calendar>
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($ch);
curl_close($ch);

$result = json_decode($data);

print '<pre>'.var_export($data,1).'</pre>';
Screen output >>> false
4

1 に答える 1

2

「独自の」AuthSub または oAuth 実装を作成できます。

以下は http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#Authから要約されています。

特定のユーザーの AuthSub トークンを取得するには、アプリケーションでユーザーを AuthSubRequest URL にリダイレクトする必要があります。これにより、ユーザーは Google アカウントにログインするように求められます。AuthSubRequest URL は次のようになります。

https://www.google.com/accounts/AuthSubRequest?scope=http%3A%2F%2Fwww.google.com%2fcalendar%2Ffeeds%2F&session=1&secure=0&next=http%3A%2F%2Fwww.coolcalendarsite.com% 2Fwelcome.html

じゃあこうして…

GET /accounts/AuthSubSessionToken HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: AuthSub token="yourAuthToken"
User-Agent: Java/1.5.0_06
Host: https://www.google.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

じゃあこうして…

GET /calendar/feeds/default/private/full HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: AuthSub token="yourSessionToken"
User-Agent: Java/1.5.0_06
Host: www.google.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

AuthSub に関するその他のドキュメント:

http://code.google.com/apis/accounts/docs/AuthSub.html

于 2010-04-29T00:20:36.113 に答える