plantnet / my.plantnet

How to use my.plantnet API ?
https://my.plantnet.org/
GNU General Public License v3.0
37 stars 5 forks source link

POST multiple images from PHP #2

Open kevinvennitti opened 1 year ago

kevinvennitti commented 1 year ago

Hi there!

I am trying to send multiple images to PlantNet API in PHP, and thanks to the doc, everything is fine with one image from an HTML input file:

$data = array(
  'organs' => 'flower',
  'images' => makeCurlFile($_FILES['images']['tmp_name'][0])
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);

curl_close($ch); 

But I can't find the right way to send multiple files:

What did I missed? 🙂

matcho commented 1 year ago

Hi,

For such a case we recommend using Guzzle library, as in this example : https://github.com/plantnet/my.plantnet/blob/master/examples/post/php/run.php