Guzzle: Parallel file download using Guzzle's Pool:batch() and `sink` option

前端 未结 3 535
暗喜
暗喜 2020-12-18 14:24

You can execute http requests in parallel using Guzzle\'s Pool:batch() method. It allows you to set default options for requests using options key

3条回答
  •  一向
    一向 (楼主)
    2020-12-18 14:55

    You can specify the $options you want on the requests individually. It would only apply to all requests if you pass it to the client. Here's the excerpt from Guzzle 6 doc:

    Headers may be added as default options when creating a client. When headers are used as default options, they are only applied if the request being created does not already contain the specific header. This include both requests passed to the client in the send() and sendAsync() methods and requests created by the client (e.g., request() and requestAsync()).

    See http://guzzle.readthedocs.org/en/latest/request-options.html?highlight=default#headers

提交回复
热议问题