2012-06-02 77 views
3

我想弄清楚這是什麼意思?我想能夠發佈一些東西到Instagram的API,但不知道什麼curl -F意味着什麼?我嘗試在谷歌搜索它,但它並沒有給我太多。也許有人有此事可以發光一些?curl -F是什麼意思? PHP的instagram

此外,用這種方法發佈到Instagram的最佳方式是什麼?該文件要求

curl -F 'access_token=ACCESS-TOKEN' \ 
    https://api.instagram.com/v1/media/{media-id}/likes 

有人可以解釋這一點給我嗎?

在此先感謝!

回答

3

curl詳細介紹它是模擬Linux工具網絡請求。發出curl -F命令發出一個帶有表單提交數據的http請求。在這種情況下,表單數據是數據access_token=ACCESS-TOKEN並且它被髮布到URL https://api.instagram.com/v1/media/{media-id}/likes

什麼捲曲是和其他信息它做什麼可以在http://curl.haxx.se/docs/manpage.html

2

-F模擬用戶填寫表單並提交。

你可以在你的系統的捲曲手冊頁上找到這個。如果它支持該選項,它將在手冊頁中有一個條目。

3

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. 

      Example, to send your password file to the server, 
      where 'password' is the name of the form-field to 
      which /etc/passwd will be the input: 

      curl -F [email protected]/etc/passwd www.mypasswords.com 

      To read content from stdin instead of a file, use - as 
      the filename. This goes for both @ and < constructs. 

      You can also tell curl what Content-Type to use by 
      using 'type=', in a manner similar to: 

      curl -F "[email protected];type=text/html" url.com 

      or 

      curl -F "name=daniel;type=text/foo" url.com 

      You can also explicitly change the name field of a 
      file upload part by setting filename=, like this: 

      curl -F "[email protected];filename=nameinpost" url.com 

      See further examples and details in the MANUAL. 

      This option can be used multiple times. 
+1

粘貼這麼多男人頁面中找到這種情況不會有幫助。 -1。 – bfavaretto

0

這是不是一個真正的編程問題,但我可以給你一些指導,幫助你的方式。

-F告訴curl模擬一個填充好的HTML表單,它已經被點擊了提交按鈕。

看一看這個頁面:http://curl.haxx.se/docs/manpage.html

,向下滾動或搜索名爲位

'-F, --form <name=content>' 

隨着與更多的複雜性