token を 使用して PHPで gistの APIで jsonを 収得したい
が
うまくいきません。
なお
ajaxでは出来るのでトークンは間違っていないです
PHP の cUrl で 出来るのでしょうか?
該当のソースコード
php
1 $curl = curl_init(); 2 $option = array( 3 CURLOPT_CUSTOMREQUEST => 'GET' , 4 CURLOPT_URL => 'https://api.github.com/gists/xxxxxxxx' , 5 CURLOPT_RETURNTRANSFER => true , 6 CURLOPT_HTTPHEADER => array( 7 'Authorization: token xxxxxxxxxxxxxxxxxxxx', 8 'Content-Type: application/json' 9 ), 10 ); 11 curl_setopt_array($curl, $option); 12 $obj = curl_exec($curl); 13 curl_close($curl);
補足情報(FW/ツールのバージョンなど)
REST API v3
https://developer.github.com/v3/gists/
Get a single gist
https://developer.github.com/v3/gists/#get-a-single-gist
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/12 11:14
退会済みユーザー
2019/07/12 11:53