0

GitHub と統合しようとしている PHP アプリケーションを入手しました。認証からコードを取得し、それを access_token と交換しようとすると、次のエラーが発生します

Cookies must be enabled to use GitHub.

リクエストを実行するために cURL ライブラリを使用しています。私が設定したヘッダーは

  • コンテンツの長さ: {length}
  • 受け入れる: アプリケーション/json
  • ユーザーエージェント: my-app

それを手伝ってもらえますか?

4

1 に答える 1

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
于 2014-12-19T13:34:01.143 に答える