• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

problem using api rpc xml call (curl error number 51)

F

fidel@

Guest
hi, all

i'm trying to connect to a plesk 8.1.1 using php curl and i'm using a couple of samples that i've seen overthere (for example, http://download1.swsoft.com/Plesk/Plesk8.1/Doc/plesk-8.1-api-rpc/)

======================

$headers = array(
'HTTP_AUTH_LOGIN: ********',
'HTTP_AUTH_PASSWD: *********',
'Content-Type: text/xml'
);

$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="1.4.0.0">
...
...
</packet>
EOF;

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://***.***.***.***:8443/enterprise/control/agent.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ( $ch, CURLOPT_VERBOSE, 1 );
$result = curl_exec($ch);
if ( $result == CURL_OK ) print_r ( curl_getinfo ( $ch ) );
else print "\n\n-----\n" . "cURL error number:" . curl_errno ( $ch ) . "\n\ncURL error:" . curl_error ( $ch );
curl_close($ch);

======================

$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<packet version="1.4.0.0">
...
...
</packet>
EOF;

$crida = "POST /enterprise/control/agent.php HTTP/1.1\r\n";
$crida .= "Host: ***.***.***.***:8443\r\n";
$crida .= "Accept: */*\r\n";
$crida .= "HTTP_AUTH_LOGIN: ********\r\n";
$crida .= "HTTP_AUTH_PASSWD: *********\r\n";
$crida .= "Pragma: no-cache\r\n";
$crida .= "Content-Length: " . strlen ( $data ) . "\r\n";
$crida .= "Content-Type: text/xml\r\n\r\n";
$crida .= $data . "\r\n";

$ch = curl_init ( 'https://***.***.***.***:8443/enterprise/control/agent.php' );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 2 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 1 );
curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, $crida );
curl_setopt ( $ch, CURLOPT_VERBOSE, 1 );
curl_setopt ( $ch, CURLOPT_NOPROGRESS, 0 );
curl_setopt ( $ch, CURLOPT_LOW_SPEED_LIMIT, 1 );
curl_setopt ( $ch, CURLOPT_LOW_SPEED_TIME, 600 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 600 );
set_time_limit( 0 );
$result = curl_exec ( $ch );
if ( $result == CURL_OK ) print_r ( curl_getinfo ( $ch ) );
else print "\n\n-----\n" . "cURL error number:" . curl_errno ( $ch ) . "\n\ncURL error:" . curl_error ( $ch );
curl_close ( $ch );

==============================

i've tried it using 'host name' and 'host ip', and i also have tried it using '1.5.0.0' and older protocol versions

it never works and i allways recieve the next error response:

cURL error number: 51

cURL error: SSL: certificate subject name '********.**********.com' does not match target host name '***.***.***.***'

have you got any idea about what i am doing wrong? can anybody help me?

thank you very much in advance & best regards

fidel
 
hi all,

i autoresponse to myself:

both php are ok (more or less), the problem was with the machine where i was executing these phps from... it had no connection to my plesk servers from there (because of some firewall rules or something like that, i don't exactly know, i'll talk with my system administrator).

i've executed them from another machine and everything worked as expected.

anyway... sorry and thanks!
 
Back
Top