diff --git a/app/Http/Controllers/TestsController.php b/app/Http/Controllers/TestsController.php index 559e9f2..3cc58c5 100755 --- a/app/Http/Controllers/TestsController.php +++ b/app/Http/Controllers/TestsController.php @@ -71,7 +71,7 @@ class TestsController $s = "/dog#list"; - $s = "/dog#github 1"; + $s = "/dog#github 1002"; $oHttp = new Http(); $oHttp->sMethod = "post"; diff --git a/app/Services/Github/Mod/Test/A.php b/app/Services/Github/Mod/Test/A.php new file mode 100755 index 0000000..72b003e --- /dev/null +++ b/app/Services/Github/Mod/Test/A.php @@ -0,0 +1,20 @@ +oHttp->sToUrl = "https://api.github.com/repos/".$oArticle->user_name."/".$oArticle->project_name; $this->oHttp->sMetHod = "get"; - $this->oHttp->bIsJson = true; +// $this->oHttp->bIsJson = true; $r = $this->oHttp->send(); + $aGitHub = json_decode($r, true); - tomd($r); + return $this->toJson($aGitHub); + +// tomd($aGitHub, 1); +// tomd($this->oHttp->sToUrl); +// tomd($r, 1); } public function List($aParam) diff --git a/app/Services/TomTool/Http.php b/app/Services/TomTool/Http.php index 936291e..a4627d9 100755 --- a/app/Services/TomTool/Http.php +++ b/app/Services/TomTool/Http.php @@ -57,15 +57,20 @@ class Http // 默认使用 GET 请求 curl_setopt($ch, CURLOPT_HTTPGET, true); // 设置为 GET 请求 curl_setopt($ch, CURLOPT_URL, $this->sToUrl . '?' . http_build_query($this->aData)); // 设置请求 URL +// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'User-Agent: JohnDoeDev' // 替换为你的应用名称 + 'User-Agent: MyCoolApp', // 替换为你的应用名称 +// 'Accept: application/vnd.github.v3+json', // 指定接受的内容类型 + 'Content-Type: application/json', // 请求内容类型 +// 'Authorization: token YOUR_ACCESS_TOKEN' // 如果需要身份验证,替换为你的访问令牌 ]); - if ($this->bIsJson) { - curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'Accept: application/json' // 设置接受的内容类型为 JSON - ]); - } +// if ($this->bIsJson) { +// curl_setopt($ch, CURLOPT_HTTPHEADER, [ +// 'Accept: application/json' // 设置接受的内容类型为 JSON +// ]); +// } + break; }