Php 如何使用curl下载github存储库或文件
我通过Php 如何使用curl下载github存储库或文件,php,git,curl,github,Php,Git,Curl,Github,我通过file\u get\u content成功地从github下载了一个存储库,但是curl的方向是什么呢 文件获取内容的优点类似于匿名。在这种情况下,可以在后台下载插件 但是Github将这种使用限制在10次以下,因为用户必须等待很长时间才能重新启动某些东西 如果使用curl,github似乎可以提供更多下载respository的权限 您是否有一个用于curl的示例(如anonymous) 下面是我举的一个例子。它可以正常工作,但不可能多次使用。少想10次 多谢各位 public fu
file\u get\u content
成功地从github下载了一个存储库,但是curl的方向是什么呢
文件获取内容的优点类似于匿名。在这种情况下,可以在后台下载插件
但是Github将这种使用限制在10次以下,因为用户必须等待很长时间才能重新启动某些东西
如果使用curl,github似乎可以提供更多下载respository的权限
您是否有一个用于curl的示例(如anonymous)
下面是我举的一个例子。它可以正常工作,但不可能多次使用。少想10次
多谢各位
public function __construct() {
$this->githubUrl = 'https://github.com';
$this->githubApi = 'https://api.github.com';
$this->githubRepo = 'repos';
$this->context = stream_context_create(array('http' => array('header' => 'User-Agent: ClicShopping',)));
$this->githubRepoClicShoppingCore = 'CoreofApplication';
$this->githubRepoName = 'addOnNameOfApplication';
}
private function getGithubRepo() {
$url = $this->githubApi . '/' . $this->githubRepo . '/' . $this->githubRepoName;
return $url;
}
private function getGithubCoreRepo() {
$url = $this->githubApi . '/' . $this->githubRepo . '/' . $this->coreName . '/' . $this->githubRepoClicShoppingCore;
return $url;
}
private function setContext() {
return $this->context;
}
private function getGithubApiClicShoppingCoreArchive() {
$url = $this->githubUrl . '/' .$this->coreName . '/' . $this->githubRepoClicShoppingCore.'/archive/master.zip';
return $url;
}
谢谢。不久前做了一些类似的东西,可能是有用的(解剖它)