• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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