This script below works fine on several server but only server from Hetzner doesn't.
// Perform login request.
$prox_ch = curl_init();
curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json/access/ticket");
curl_setopt($prox_ch, CURLOPT_POST, true);
curl_setopt($prox_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $login_postfields_string);
curl_setopt($prox_ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl);
$login_ticket = curl_exec($prox_ch);
$login_request_info = curl_getinfo($prox_ch);
if (!$login_ticket) {
// SSL negotiation failed or connection timed out
$this->login_ticket_timestamp = null;
print '<pre>';
print_r($login_request_info);
print '</pre>';
print " SSL negotiation failed or connection timed out";
return false;
}
The above script will return "SSL negotiation failed or connection timed out" because the $login_ticket failed.
It's works when using https://my-server-ip:8006 to make sure the username and password is right.
Any suggestions how to fix this issue?
<?php
require_once("pve2_api.class.php");
$pve2 = new PVE2_API("my-server-ip", "root", "pam", "my-password");
if ($pve2->login()) {
foreach ($pve2->get_node_list() as $node_name) {
print_r($pve2->get("/nodes/".$node_name."/status"));
}
} else {
print("Login to Proxmox Host failed.\n");
exit;
}
?>
To show detail error, I have added a break-point to determine the error point at pve2_api.class.php:require_once("pve2_api.class.php");
$pve2 = new PVE2_API("my-server-ip", "root", "pam", "my-password");
if ($pve2->login()) {
foreach ($pve2->get_node_list() as $node_name) {
print_r($pve2->get("/nodes/".$node_name."/status"));
}
} else {
print("Login to Proxmox Host failed.\n");
exit;
}
?>
// Perform login request.
$prox_ch = curl_init();
curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json/access/ticket");
curl_setopt($prox_ch, CURLOPT_POST, true);
curl_setopt($prox_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $login_postfields_string);
curl_setopt($prox_ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl);
$login_ticket = curl_exec($prox_ch);
$login_request_info = curl_getinfo($prox_ch);
if (!$login_ticket) {
// SSL negotiation failed or connection timed out
$this->login_ticket_timestamp = null;
print '<pre>';
print_r($login_request_info);
print '</pre>';
print " SSL negotiation failed or connection timed out";
return false;
}
The above script will return "SSL negotiation failed or connection timed out" because the $login_ticket failed.
It's works when using https://my-server-ip:8006 to make sure the username and password is right.
Any suggestions how to fix this issue?