1

I am trying to fetch content of single file from GitHub with php . I have searched a lot but no luck . Here are some links Github access

all these are working for public repo . i also have tried it with access token

https://raw.githubusercontent.com/builderux/dev_elead/master/Elead.php?access_token=**************************************

this token is working to download zip file . But for single file it is showing not found error

Community
  • 1
  • 1
Manoj Dhiman
  • 5,096
  • 6
  • 29
  • 68

1 Answers1

0

You can use GitHub's Contents API to obtain the Base64-encoded contents of a file (for files of up to one megabyte) by issuing an HTTP GET request to /repos/:owner/:repo/contents/:path.

PHP's base64_decode() function should then be able to decode this back to the original file contents.

kfb
  • 6,252
  • 6
  • 40
  • 51