Код: Выделить всё
{
"message":"Not Found",
"documentation_url":"https://docs.github.com/rest",
"status":"404"
}
Код: Выделить всё
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.github.com/MY_USERNAME/repos',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
"Accept: application/vnd.github+json",
"Authorization: Bearer MY_TOKEN",
"X-GitHub-Api-Version: 2022-11-28",
"User-Agent: MY_APP_NAME"
),
CURLOPT_POSTFIELDS => array(
"name" => "test-repo-123",
"description" => "This is your first repo!",
"homepage" => "https://MY_URL",
"private" => true,
"is_template" => true
),
));
$response = curl_exec($curl);
curl_close($curl);
Когда я обрезал строку:
Код: Выделить всё
"User-Agent: MY_APP_NAME"
Код: Выделить всё
Request forbidden by administrative rules. Please make sure your request has a User-Agent header (https://docs.github.com/en/rest/overview/resources-in-the-rest-api#user-agent-required). Check https://developer.github.com for other possible causes.
Что такое Я делаю неправильно?
Спасибо
Майк
Подробнее здесь: https://stackoverflow.com/questions/792 ... ub-user-re