“卷曲”是什么意思?

时间:2012-03-17 09:26:12

标签: javascript facebook curl

我每天都在开发Facebook JavaScript应用程序,但在Facebook文档和我访问的其他网站上,一直绊倒一些我不理解的代码片段。

我在谷歌搜索了CURL,并找到了一些关于它的描述。我无法弄清楚Facebook是如何让我使用它的。

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

对我来说这是不可能的。你能帮助我理解我可以在Facebook上使用它的背景,也许总的来说,并指导我在哪个方向找到更多关于这个主题的正确方向?

4 个答案:

答案 0 :(得分:14)

curl是一个命令行实用程序,可让您发送HTTP请求。它对于使用Web服务API进行开发非常有用。我相信它预先安装了大多数Linux发行版,但你需要下载并安装它用于Windows。 (它可能与Cygwin一起提供,但也可以单独安装。)

我建议确保将其目录添加到PATH环境变量中。同样,在Linux中可能不是问题,但你需要在Windows中手动执行此操作。

答案 1 :(得分: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.

答案 2 :(得分:2)

答案 3 :(得分:0)

当然FB文档使用curl来显示执行请求的常用基本方法...这取决于您使用实际方式执行图形http请求的平台语言库

...如果你是Facebook JavaScript开发人员,你必须使用XMLHttpRequest(或者我想facebook js lib调用)

相关问题