sending xml and headers via curl

前端 未结 1 2058
暖寄归人
暖寄归人 2020-12-11 22:42

wondering how I can set all this data in a curl session, via php:

POST /feeds/api/users/default/uploads HTTP/1.1
Host: uploads.gdata.youtube.com
Authorizatio         


        
1条回答
  •  误落风尘
    2020-12-11 22:49

    The boundary is required because the form enctype is multipart/form-data, rather in this case multipart/related. The boundary is a unique string that cannot appear anywhere else in the request, and it is used to separate each element from the form, whether it is the value of a text input, or a file upload. Each boundary has its own content-type.

    Curl cannot do multipart/related for you, so you will need to use a workaround, see this message from the curl mailing list for suggestions. Basically, you will have to construct most of the message yourself.

    Note, the last boundary has an additional -- at the end.

    This code should hopefully help get you started:

    Hope that helps.

    0 讨论(0)
提交回复
热议问题