mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-19 18:21:59 +00:00
18 lines
337 B
PHP
18 lines
337 B
PHP
<?php
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
use \Curl\Curl;
|
|
|
|
$myfile = curl_file_create('cats.jpg', 'image/png', 'test_name');
|
|
|
|
$curl = new Curl();
|
|
$curl->post('https://httpbin.org/post', array(
|
|
'myfile' => $myfile,
|
|
));
|
|
|
|
if ($curl->error) {
|
|
echo 'Error: ' . $curl->errorMessage . "\n";
|
|
} else {
|
|
echo 'Success' . "\n";
|
|
}
|