36
41

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

APIを使わずにGoogleカレンダーに予定を作成する

Posted at

結論:URLにパラメータを設定します。

例えばこんなイベントをカレンダーに登録したいとき。

$event = array(
  "title" => "北海道旅行",
  "description" => "ぶらり旅",
  "place" => "北海道",
  "start_date" => "20200909T122530",
  "end_date" => "20200910T230030"
);

このイベント情報を含めたURLを組み立てます。

$url =
  "http://www.google.com/calendar/event?"
    ."action="    ."TEMPLATE"
    ."&text="     . $event["title"]
    ."&details="  . $event["description"]
    ."&location=" . $event["place"]
    ."&dates="    . $event["start_date"]. "/". $event["end_date"];

オプションの内容は
text 予定タイトル
details 予定詳細
location 場所
dates 開始日時と終了日時
sprop リンク元など
 spropは&で繋げれば複数設定できるようです。

あとはこのURLを叩くだけです。

<html>
<head>
<body>
  <a href=<?php echo $url?>>カレンダーに登録</a>
</body>
</head>
</html>

参考
googleカレンダーにurlパラメーターから追加する

36
41
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
36
41

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?