-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_image.php
More file actions
42 lines (34 loc) · 995 Bytes
/
Copy pathtest_image.php
File metadata and controls
42 lines (34 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
include 'jwt.php';
$token = getJubelioToken();
if (!$token) {
die("❌ Gagal ambil token.");
}
$imagePath = "11.jpg"; // pastikan file ada di folder ini
if (!file_exists($imagePath)) {
die("❌ File tidak ditemukan: $imagePath");
}
$url = "https://api2.jubelio.com/inventory/upload-image";
$postFields = [
"uid" => uniqid("img-"),
"name" => basename($imagePath),
"imageType" => "1",
"file" => new CURLFile($imagePath, mime_content_type($imagePath), basename($imagePath))
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postFields,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $token"
],
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "TOKEN:\n$token\n";
echo "HTTP CODE: $httpCode\n";
echo "RESPONSE:\n$response\n";