Fix #384: Add multi curl file upload example

This commit is contained in:
Zach Borboa
2016-09-01 23:42:52 -07:00
parent ae6a3e5c28
commit 7f66973a8c
+25
View File
@@ -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();