2012-03-17 148 views
18

我每天都在開發Facebook JavaScript應用程序,但仍然陷入我不明白的一些代碼片段,Facebook文檔和我訪問的其他網站。「捲曲」是什麼意思?

我搜索了Google的CURL,並找到了一些關於它的描述。我無法弄清楚Facebook如何讓我使用它。

curl -F "title=Example Title" -F "description=Description" \ 
-F "start_time=1329417443" \ 
"https://graph.facebook.com/PAGE_ID/milestones?access_token=_" 

這對我來說是無生氣的。你能幫我理解我可以在什麼環境下使用Facebook,也可以在一般情況下,引導我朝正確的方向去尋找更多關於這個主題的內容?

+2

順便說一句,'curl'代表「客戶端URL」,在這個SO中看到更多答案:http://stackoverflow.com/questions/27788997/what-does-the-c-in -curl-stand-for – Andrejs 2016-06-26 10:50:36

回答

13

捲曲是一個命令行工具,它可以發送一個HTTP請求。使用Web服務API進行開發可能非常有用。我相信它預裝了大多數Linux發行版,但是您需要爲Windows下載並安裝它。 (它可能與Cygwin一起提供,但也可以自行安裝。)

我建議確保它的目錄已添加到PATH環境變量中。再次,可能不是Linux中的問題,但您需要在Windows中手動執行此操作。

6

curl是獲取請求的命令。 -F--form)參數用於指定表單POST參數。

引文從man curl

-F/--form <name=content> 
      (HTTP) This lets curl emulate a filled-in form in which a user 
      has pressed the submit button. This causes curl to POST data 
      using the Content-Type multipart/form-data according to RFC 
      2388. This enables uploading of binary files etc. To force the 
      'content' part to be a file, prefix the file name with an @ 
      sign. To just get the content part from a file, prefix the file 
      name with the symbol <. The difference between @ and < is then 
      that @ makes a file get attached in the post as a file upload, 
      while the < makes a text field and just get the contents for 
      that text field from a file. 
+0

PS。我雖然很明顯,'curl'的最後一個參數是表單提交位置。以防萬一。 – 2012-03-17 09:40:24

0

當然FB文檔使用捲曲來顯示一個共同的ba sic的方式來執行請求...這取決於什麼平臺語言庫是你使用實際的方式來執行圖http請求

...所以,如果你是Facebook的JavaScript開發人員,你必須使用XMLHttpRequest(或我想facebook sj lib調用)