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

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?