简体   繁体   中英

How to fetch content of single file from private git repo with php

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM