본문으로 바로가기

[PHP] Google Calendar API 사용하기 #1

category Helloworld!/PHP 2014. 12. 29. 17:45
1. 구글 API 인증키 발급 방법


- Google Developer Console에서 (https://console.developers.google.com/) "Create Project"해서 새로운 Project를 생성한다.
- 생성이 완료되면 사이드바중에서 "APIs & auth" 의 "APIs"로 이동한다.
- Calendar API를 찾아 Status를 On으로 바꾼다





- 다시 사이드바중에  "APIs & auth"의 "Credentials"로 이동한다
- 여기서 "Public API access"에 "Create new Key"를 클릭한다





- "Browser key" 클릭
- 입력박스에 본인의 domain을 입력한다. 나중에 수정도 가능하니까 신중할필요없음. 그다음 Create 버튼을 누르면 생성된다











- 만들면 다음과 같은데 여기서 API KEY를 기억한다. (ex. d1u2m3m4y567890)





- REFERERS 를 바꿀때는 "Edit allowd referes" 클릭




(참고 사이트 : http://fullcalendar.io/docs/google_calendar/)


You must first have a Google Calendar API Key:
1. Go to the Google Developer Console and create a new project (it might take a second).
2. Once in the project, go to APIs & auth > APIs on the sidebar.
3. Find "Calendar API" in the list and turn it ON.
4. On the sidebar, click APIs & auth > Credentials.
5. In the "Public API access" section, click "Create new Key".
6. Choose "Browser key".
7. If you know what domains will host your calendar, enter them into the box. Otherwise, leave it blank. You can always change it later.
8. Your new API key will appear. It might take second or two before it starts working.


2. 대한민국 휴일 정보 얻는 방법


- 구글에서 Calendar 로 이동 (https://www.google.com/calendar)
- 사이드바에 "다른 캘린더" 옆에 있는 화살표 클릭하면 메뉴가 뜨는데 여기서 "재미있는 캘린더 검색" 클릭







- 여기서 "대한민국의 휴일"을 찾아 추가를 한다.






- 추가가 완료되면 "캘린더로 돌아가기" 또는 페이지 뒤로 이동을 해서 전 페이지로 돌아와서 보면 "다른 캘린더" 에 "대한민국의 휴일"이 추가되있는걸 볼수 있다.
- 여기서 "대한민국의 휴일"에 마우스 오버하면 화살표 버튼이 생기는데 그 버튼을 클릭하면 다음과 같은 메뉴가 뜬다. 이때 "캘린더 설정" 클릭









- 이중에 "캘린더 주소"에 써있는 "캘린더 ID" 값을 기억한다









(참고 사이트 : http://fullcalendar.io/docs/google_calendar/)



Obtain your Google Calendar's ID:
In the Google Calendar interface, locate the "My calendars" area on the left.
Hover over the calendar you need and click the downward arrow.
A menu will appear. Click "Calendar settings".
In the "Calendar Address" section of the screen, you will see your Calendar ID. It will look something like "abcd1234@group.calendar.google.com".