2012-03-17 145 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调用)