Skip to content

Commit

Permalink
글 포스팅 추가
Browse files Browse the repository at this point in the history
카스 글 포스팅 추가

[ticket: X]
  • Loading branch information
pouu69 committed Nov 17, 2016
1 parent 76fcd75 commit a12099d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ return [
- 사용자 정보 요청
- 카카오 스토리 API
- 사용자 확인
- 글 포스팅(only 글)
- 사진(photo) 포스팅
- 사진 업로드
- 퍼블리싱(포스팅)
Expand Down Expand Up @@ -177,6 +178,17 @@ if(session()->has('kakao_access_token') && session()->has('kakao_refresh_token')
$error = json_decode($e->getMessage());
}
````
##카카오 스토리 API - 글 포스팅(only 글)
- 오로지 글만 포스팅 합니다.

```` php
try{
$content = '이것이 내용입니다.';
$result = Kakao::postNote($content, session()->get('kakao_access_token'));
}catch(\Exception $e){
var_dump($e->getMessage());
}
````

##카카오 스토리 API - 사진 포스팅
### 사진 업로드
Expand Down
24 changes: 23 additions & 1 deletion src/Traits/KakaoStoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,30 @@ public function isStoryUser($accessToken){
return $this->get($this->API_TYPE, $requestAPI, $options);
}

public function postNote(){
/**
* 글 포스팅
* @param string $content 내용
* @param string $accessToken 사용자 엑새스 토큰
* @return array response
*/
public function postNote($content, $accessToken){
$requestAPI = $this->API_VERSION.'/api/story/post/note';

$header = [
'Content-Type' => "application/x-www-form-urlencoded;charset=utf-8",
'Authorization' => "Bearer {$accessToken}"
];

$data = [
'content' => $content
];

$options = [
'headers' => $header,
'form_params' => $data
];

return $this->post($this->API_TYPE, $requestAPI, $options);
}

/**
Expand Down

0 comments on commit a12099d

Please sign in to comment.