2013-03-03 1 views
0

GitHub와 통합하려고하는 PHP 응용 프로그램이 있습니다. 나는 인증의 코드를 얻고 나는 다음과 같은 오류GitHub Acces 토큰 POST 오류 (쿠키 필요)

Cookies must be enabled to use GitHub. 

내 요청을 수행하기 위해 컬 라이브러리를 사용하고 있습니다에게 무엇입니까 access_token은 그것을 교환하려고하면. 내가 설정 한 헤더는

  • 콘텐츠 길이 : {길이}
  • 수락 : 응용 프로그램/JSON
  • 사용자 에이전트 : 내 - 응용 프로그램

가 좀 도와 주 시겠어요?

+0

봅니다 ('쿠키 항아리') 쿠키를 사용하여 컬을 구성 할 수 있습니다. 이를 달성하는 방법은 http://php.net/manual/en/book.curl.php 또는 StackOverflow http://stackoverflow.com/questions/4126374/using-cookies-with-curl 문서를 참조하십시오. – thaJeztah

+0

불행히도 그것은 작동하지 않았다. – Paris

+0

사용 하시려는 코드 스 니펫을 공유해 주시겠습니까? –

답변

1

사용

/* cURL will start a new cookie session and ignore any previous cookies */ 
curl_setopt($ch, CURLOPT_COOKIESESSION, true); 
/* this is the name of the file where cURL should save cookie information */ 
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); 
// could be empty, but cause problems on some hosts