7

私はこれが何を意味するのか理解しようとしていますか?Instagram の API に投稿できるようにしたいのですが、curl -F の意味がわかりません。グーグルで検索してみましたが、あまりヒットしません。たぶん、この問題を抱えている誰かが光を当てることができますか?

また、この方法でInstagramに投稿する最良の方法は何ですか? ドキュメントは求めています

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

誰かが私にこれを説明できますか?

前もって感謝します!

4

4 に答える 4

5

から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 password=@/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 "web=@index.html;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 "file=@localfile;filename=nameinpost" url.com

          See further examples and details in the MANUAL.

          This option can be used multiple times.
于 2012-06-02T02:37:23.083 に答える
3

curlWeb リクエストをシミュレートする Linux ユーティリティです。コマンドを発行するcurl -Fと、フォーム送信データを含む http 要求が発行されます。この場合、フォームデータはデータaccess_token=ACCESS-TOKENであり、url に発行されています。https://api.instagram.com/v1/media/{media-id}/likes

cURL とは何か、およびその機能についての詳細は、http://curl.haxx.se/docs/manpage.htmlを参照してください。

于 2012-06-02T02:40:34.023 に答える
2

-Fユーザーがフォームに入力して送信するのをエミュレートします。

これは、システムの curl の man ページで確認できます。オプションがサポートされている場合は、man ページにエントリがあります。

于 2012-06-02T02:37:02.450 に答える
0

これは実際にはプログラミングに関する質問ではありませんが、道を進む上で役立つガイダンスを提供できます。

-F は、送信ボタンがクリックされたばかりの入力済み HTML フォームをエミュレートするよう curl に指示します。

このページをご覧ください: http://curl.haxx.se/docs/manpage.html

下にスクロールするか、呼び出されたビットを検索します

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

それがより複雑にそれを詳述するように

于 2012-06-02T02:40:13.803 に答える