2012-11-25 48 views
-7

我正在嘗試使用soundcloud api並驗證我的帳戶,並且此站點https://github.com/mptre/php-soundcloud/wiki/Oauth-2解釋爲使用github中的git命令下載存儲庫。我曾嘗試手動下載文件,但其中有錯誤。這個命令似乎什麼都不做:$ git clone git://github.com/mptre/php-soundcloud.git,實際上它給了我一個錯誤。php - 使用git命令不工作?

全碼:

<? 
$ git clone git://github.com/mptre/php-soundcloud.git 

$soundcloud = new Services_Soundcloud('somekey', 'someotherkey', 'wonderfulworldofchris.com/soundcloud'); 

$authorizeUrl = $soundcloud->getAuthorizeUrl(); 



?> 

<a href="<?php echo $authorizeUrl; ?>">Connect with SoundCloud</a> 
+1

你會得到什麼錯誤?是'git clone git://github.com/mptre/php-soundcloud.git'在你的PHP腳本中的行嗎? – Repox

+0

我曾經用「$」試過它,沒有,我得到錯誤T-STRING,當出現錯誤和意外的T_CLONE而沒有 – Shawn

+1

那麼,那是因爲它不適用於PHP。它顯示瞭如何從命令行克隆GitHub存儲庫。 – Repox

回答

3

要下載的資源庫,你需要安裝的git - http://git-scm.com/

之後,正從命令行代碼爲git clone git://github.com/mptre/php-soundcloud.git一樣容易。但是,這應該在命令行中完成,而不是在php代碼中完成。

也可以下載回購作爲一個zip文件:https://github.com/mptre/php-soundcloud/archive/master.zip

你下載這個項目後,你需要包括「Services_Soundcloud」在您的應用程序。那麼你應該可以做

<? 
$soundcloud = new Services_Soundcloud('somekey', 'someotherkey', 'wonderfulworldofchris.com/soundcloud'); 
$authorizeUrl = $soundcloud->getAuthorizeUrl(); 
?> 
+1

可以從GitHub Repository網站下載它,但這不能回答OP的問題。 – Repox

+1

我沒有看到如何有另一種下載方法使答案受到downvoting。 – Titas

+0

我其實在你的第一篇文章中說過,它沒有回答OP的問題。你已經編輯了答案 - 不要太驚訝。 – Repox