How to avoid getting 403 error from Github API?How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to get the client IP address in PHPGitHub API: using 'repo' scope, but still can't see private reposNot Getting Link Response Headers in GitHub Pagination For IssuesRead all commits for a project using the GitHub APIGithub Api list commit status when repository is under organisationGithub API compare a single directory between two SHAsGitHub Push Event All Commitsgithub api get commits and commiters

How to cope with regret and shame about not fully utilizing opportunities during PhD?

After Restoring Log Shipping to Secondary Server, First Stored Procedure Execution is Slow

Was the dragon prowess intentionally downplayed in S08E04?

Help understanding this line - usage of くれる

Are there any sonatas with only two sections?

White foam around tubeless tires

Could there be a material that inverts the colours seen through it?

Single word that parallels "Recent" when discussing the near future

Developers demotivated due to working on same project for more than 2 years

How does this Martian habitat 3D printer built for NASA work?

How to make a not so good looking person more appealing?

Wireless headphones interfere with Wi-Fi signal on laptop

How to insert a name of the file as a header of a file?

Segmentation fault when popping x86 stack

About matrices whose row and column sums are 0

Do we have C++20 ranges library in GCC 9?

Given 0s on Assignments with suspected and dismissed cheating?

Is Valonqar prophecy unfulfilled?

Find the unknown area, x

Can only the master initiate communication in SPI whereas in I2C the slave can also initiate the communication?

Is there an academic word that means "to split hairs over"?

Acronyms in HDD specification

Were any toxic metals used in the International Space Station?

How do I adjust encounters to challenge my lycanthrope players without negating their cool new abilities?



How to avoid getting 403 error from Github API?


How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to get the client IP address in PHPGitHub API: using 'repo' scope, but still can't see private reposNot Getting Link Response Headers in GitHub Pagination For IssuesRead all commits for a project using the GitHub APIGithub Api list commit status when repository is under organisationGithub API compare a single directory between two SHAsGitHub Push Event All Commitsgithub api get commits and commiters






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I'm trying to get every modified lines a user did on his Github account. I did a little PHP script, with some foreach() loops. The problem is that I get everytime a 403 error from the Github API.



I already tryied to change the header. I was doing this :



$get_options = array('http' => array('user_agent' => 'Dev-Purpose'));
$context = stream_context_create($options);
$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


So I changed to this :



$get_options = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: Gabyfle'
]
]
];
$context = stream_context_create($get_options);

$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


But it didn't solve the problem. I still get this 403 error.



I'm doing this to get every modified lines from a Github account :



foreach ($repositeries as $id => $value) 
$repo_name = $value["name"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits";
$json = file_get_contents($jsonurl, false, $context);
$commits = json_decode($json, true);

foreach ($commits as $id => $value)
$sha = $value["sha"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits/" . $sha;
$json = file_get_contents($jsonurl, false, $context);
$datas = json_decode($json, true);
/* Adding lines to vars */
$totalLines = $totalLines + $datas["stats"]["total"];
$addedLines = $addedLines + $datas["stats"]["additions"];
$deletedLines = $deletedLines + $datas["stats"]["deletions"];




The expected results are every statistics from Github Commits API.
The first time I launched the script, the very first loops worked, and I get something like 195 for $totalLines. But after looking into my PHP local server, I saw 403 errors for the other loops.



Anyone knows how I can fix this, so I can get every modified lines from a certain Github account ?



Thanks a lot for your time,
Gabyfle.










share|improve this question






















  • I would like to add that this script is very long to execute...

    – Gabriel Santamaria
    Mar 23 at 14:25











  • It's not clear to me whether you are sending a Authorization header with each request. A HTTP 403 Forbidden response suggests that you are trying to access a private repository.

    – Brendan Forster
    Mar 30 at 18:19

















2















I'm trying to get every modified lines a user did on his Github account. I did a little PHP script, with some foreach() loops. The problem is that I get everytime a 403 error from the Github API.



I already tryied to change the header. I was doing this :



$get_options = array('http' => array('user_agent' => 'Dev-Purpose'));
$context = stream_context_create($options);
$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


So I changed to this :



$get_options = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: Gabyfle'
]
]
];
$context = stream_context_create($get_options);

$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


But it didn't solve the problem. I still get this 403 error.



I'm doing this to get every modified lines from a Github account :



foreach ($repositeries as $id => $value) 
$repo_name = $value["name"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits";
$json = file_get_contents($jsonurl, false, $context);
$commits = json_decode($json, true);

foreach ($commits as $id => $value)
$sha = $value["sha"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits/" . $sha;
$json = file_get_contents($jsonurl, false, $context);
$datas = json_decode($json, true);
/* Adding lines to vars */
$totalLines = $totalLines + $datas["stats"]["total"];
$addedLines = $addedLines + $datas["stats"]["additions"];
$deletedLines = $deletedLines + $datas["stats"]["deletions"];




The expected results are every statistics from Github Commits API.
The first time I launched the script, the very first loops worked, and I get something like 195 for $totalLines. But after looking into my PHP local server, I saw 403 errors for the other loops.



Anyone knows how I can fix this, so I can get every modified lines from a certain Github account ?



Thanks a lot for your time,
Gabyfle.










share|improve this question






















  • I would like to add that this script is very long to execute...

    – Gabriel Santamaria
    Mar 23 at 14:25











  • It's not clear to me whether you are sending a Authorization header with each request. A HTTP 403 Forbidden response suggests that you are trying to access a private repository.

    – Brendan Forster
    Mar 30 at 18:19













2












2








2


1






I'm trying to get every modified lines a user did on his Github account. I did a little PHP script, with some foreach() loops. The problem is that I get everytime a 403 error from the Github API.



I already tryied to change the header. I was doing this :



$get_options = array('http' => array('user_agent' => 'Dev-Purpose'));
$context = stream_context_create($options);
$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


So I changed to this :



$get_options = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: Gabyfle'
]
]
];
$context = stream_context_create($get_options);

$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


But it didn't solve the problem. I still get this 403 error.



I'm doing this to get every modified lines from a Github account :



foreach ($repositeries as $id => $value) 
$repo_name = $value["name"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits";
$json = file_get_contents($jsonurl, false, $context);
$commits = json_decode($json, true);

foreach ($commits as $id => $value)
$sha = $value["sha"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits/" . $sha;
$json = file_get_contents($jsonurl, false, $context);
$datas = json_decode($json, true);
/* Adding lines to vars */
$totalLines = $totalLines + $datas["stats"]["total"];
$addedLines = $addedLines + $datas["stats"]["additions"];
$deletedLines = $deletedLines + $datas["stats"]["deletions"];




The expected results are every statistics from Github Commits API.
The first time I launched the script, the very first loops worked, and I get something like 195 for $totalLines. But after looking into my PHP local server, I saw 403 errors for the other loops.



Anyone knows how I can fix this, so I can get every modified lines from a certain Github account ?



Thanks a lot for your time,
Gabyfle.










share|improve this question














I'm trying to get every modified lines a user did on his Github account. I did a little PHP script, with some foreach() loops. The problem is that I get everytime a 403 error from the Github API.



I already tryied to change the header. I was doing this :



$get_options = array('http' => array('user_agent' => 'Dev-Purpose'));
$context = stream_context_create($options);
$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


So I changed to this :



$get_options = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: Gabyfle'
]
]
];
$context = stream_context_create($get_options);

$jsonurl = "https://api.github.com/users/" . $github_user . "/repos";
$json = file_get_contents($jsonurl, false, $context);


But it didn't solve the problem. I still get this 403 error.



I'm doing this to get every modified lines from a Github account :



foreach ($repositeries as $id => $value) 
$repo_name = $value["name"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits";
$json = file_get_contents($jsonurl, false, $context);
$commits = json_decode($json, true);

foreach ($commits as $id => $value)
$sha = $value["sha"];
$jsonurl = "https://api.github.com/repos/" . $github_user . "/" . $repo_name . "/commits/" . $sha;
$json = file_get_contents($jsonurl, false, $context);
$datas = json_decode($json, true);
/* Adding lines to vars */
$totalLines = $totalLines + $datas["stats"]["total"];
$addedLines = $addedLines + $datas["stats"]["additions"];
$deletedLines = $deletedLines + $datas["stats"]["deletions"];




The expected results are every statistics from Github Commits API.
The first time I launched the script, the very first loops worked, and I get something like 195 for $totalLines. But after looking into my PHP local server, I saw 403 errors for the other loops.



Anyone knows how I can fix this, so I can get every modified lines from a certain Github account ?



Thanks a lot for your time,
Gabyfle.







php github-api http-status-code-403






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 13:37









Gabriel SantamariaGabriel Santamaria

215




215












  • I would like to add that this script is very long to execute...

    – Gabriel Santamaria
    Mar 23 at 14:25











  • It's not clear to me whether you are sending a Authorization header with each request. A HTTP 403 Forbidden response suggests that you are trying to access a private repository.

    – Brendan Forster
    Mar 30 at 18:19

















  • I would like to add that this script is very long to execute...

    – Gabriel Santamaria
    Mar 23 at 14:25











  • It's not clear to me whether you are sending a Authorization header with each request. A HTTP 403 Forbidden response suggests that you are trying to access a private repository.

    – Brendan Forster
    Mar 30 at 18:19
















I would like to add that this script is very long to execute...

– Gabriel Santamaria
Mar 23 at 14:25





I would like to add that this script is very long to execute...

– Gabriel Santamaria
Mar 23 at 14:25













It's not clear to me whether you are sending a Authorization header with each request. A HTTP 403 Forbidden response suggests that you are trying to access a private repository.

– Brendan Forster
Mar 30 at 18:19





It's not clear to me whether you are sending a Authorization header with each request. A HTTP 403 Forbidden response suggests that you are trying to access a private repository.

– Brendan Forster
Mar 30 at 18:19












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314282%2fhow-to-avoid-getting-403-error-from-github-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314282%2fhow-to-avoid-getting-403-error-from-github-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript