curl -F что это значит? php instagram (php instagram)


Я пытаюсь понять, что это значит? Я хочу иметь возможность публиковать что-то в API Instagram, но не уверен, что означает curl-F? Я попытался найти его в Google, но это не дало мне многого. Может быть, кто-то с этим вопросом может пролить немного света?

Кроме того, каков наилучший способ публикации в Instagram с помощью этого метода? В документации задается вопрос

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

Может ли кто-нибудь объяснить мне это?

Заранее спасибо!

Author: hellomello, 2012-06-02

4 answers

curl это утилита 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

 3
Author: firelore, 2012-06-02 02:40:34

Из 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 "[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 "file=@localfile;filename=nameinpost" url.com

          See further examples and details in the MANUAL.

          This option can be used multiple times.
 3
Author: sarnold, 2012-06-02 02:37:23

-F имитировать заполнение пользователем формы и отправку.

Вы можете найти это на справочной странице curl в вашей системе. Если он поддерживает эту опцию, у него будет запись на справочной странице.

 2
Author: nhahtdh, 2012-06-02 02:37:02

На самом деле это не вопрос программирования, но я могу дать вам некоторые рекомендации, которые помогут вам на вашем пути.

-F говорит curl эмулировать заполненную HTML-форму, на которой только что была нажата кнопка "Отправить".

Взгляните на эту страницу: http://curl.haxx.se/docs/manpage.html

И прокрутите вниз или найдите бит с именем

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

Поскольку это детализирует его с большей сложностью

 0
Author: Russ Clarke, 2012-06-02 02:40:13