mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-06 15:58:10 +00:00
Fix #384: Add multi curl file upload example
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use \Curl\MultiCurl;
|
||||
|
||||
$multi_curl = new MultiCurl();
|
||||
|
||||
// HINT: If API documentation refers to using something like curl -F "myimage=image.png",
|
||||
// curl --form "myimage=image.png", or the html form is similar to <form enctype="multipart/form-data" method="post">,
|
||||
// then try uncommenting the following line:
|
||||
// $multi_curl->setHeader('Content-Type', 'multipart/form-data');
|
||||
|
||||
$multi_curl->addPost('https://httpbin.org/post', array(
|
||||
'image' => new CURLFile('the-lorax.jpg'),
|
||||
));
|
||||
|
||||
$multi_curl->addPost('https://httpbin.org/post', array(
|
||||
'image' => new CURLFile('swomee-swans.jpg'),
|
||||
));
|
||||
|
||||
$multi_curl->addPost('https://httpbin.org/post', array(
|
||||
'image' => new CURLFile('truffula-trees.jpg'),
|
||||
));
|
||||
|
||||
$multi_curl->start();
|
||||
Reference in New Issue
Block a user