Hallo zusammen,
ich versuche per PHP mit cURL Post eine ISO Image an die PVE API "/api2/json/nodes/pve1/storage/cephfs/upload" hochzuladen. Leider erhalte ich immer Error 502.
Wenn jemand einen Tip hat vielen Danke
PHP Curl
Ausgabe der Curl mit HTTP Error 502
ich versuche per PHP mit cURL Post eine ISO Image an die PVE API "/api2/json/nodes/pve1/storage/cephfs/upload" hochzuladen. Leider erhalte ich immer Error 502.
Wenn jemand einen Tip hat vielen Danke
PHP Curl
PHP:
# API URL
$url_api = "https://$dc_host:$dc_port/api2/json/nodes/pve1/storage/cephfs/upload";
# File to Upload
$file = "/home/pbs3.iso";
# Curl Header
$headers = array(
"CSRFPreventionToken: $dc_token",
'Content-type: multipart/form-data'
);
# Curl Post Fields
$postFields = [
'filename' => curl_file_create($file, mime_content_type($file)),
'content' => 'iso',
];
# http_build_query
$postFieldString = http_build_query($postFields);
$ch = curl_init($url_api);
curl_setopt($ch, CURLOPT_HEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFieldString);
curl_setopt($ch, CURLOPT_COOKIE, "PVEAuthCookie=$dc_ticket");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$ch_output = curl_exec($ch);
Ausgabe der Curl mit HTTP Error 502
Code:
(
[url] => https://192.168.20.11:8006/api2/json/nodes/pve1/storage/cephfs/upload
[content_type] => text/html
[http_code] => 502
[header_size] => 138
[request_size] => 551
[filetime] => -1
[ssl_verify_result] => 20
[redirect_count] => 0
[total_time] => 5.021247
[namelookup_time] => 0.002089
[connect_time] => 0.002211"
[pretransfer_time] => 0.004153
[size_upload] => 93
[size_download] => 11939
[speed_download] => 2377
[speed_upload] => 18
[download_content_length] => 11939
[upload_content_length] => 93
[starttransfer_time] => 0.004157
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 192.168.20.11
[certinfo] => Array
(
)
[primary_port] => 8006
[local_ip] => 192.168.20.11
[local_port] => 42346
[http_version] => 3
[protocol] => 2
[ssl_verifyresult] => 0
[scheme] => HTTPS
[appconnect_time_us] => 4010
[connect_time_us] => 2211
[namelookup_time_us] => 2089
[pretransfer_time_us] => 4153
[redirect_time_us] => 0
[starttransfer_time_us] => 4157
[total_time_us] => 5021247
)