cipcip
Basic Pleskian
Hi guys,
I did not had any issues with this on my localhost, but apparently as soon as i uploaded to the server, I get errors about the curlinitialize file that i have for API. I can't remember where I took it from now, it was not written by me, but can you help me with this ?
Errors received:
The PHP code for the file is:
Thank you
I did not had any issues with this on my localhost, but apparently as soon as i uploaded to the server, I get errors about the curlinitialize file that i have for API. I can't remember where I took it from now, it was not written by me, but can you help me with this ?
Errors received:
[Sat Jan 26 01:55:12.200814 2019] [proxy_fcgi:error] [pid 9549:tid 140402248107776] [client 188.250.203.236:56547] AH01071: Got error 'PHP message: PHP Warning: curl_setopt(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 22\nPHP message: PHP Warning: curl_exec(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 24\nPHP message: PHP Warning: curl_errno(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 26\nPHP message: PHP Warning: curl_close(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 32\nPHP message: PHP Warning: curl_setopt(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 22\nPHP message: PHP Warning: curl_exec(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 24\nPHP message: PHP Warning: curl_errno(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 26\nPHP message: PHP Warning: curl_close(): supplied resource is not a valid cURL handle resource in /var/www/vhosts/domain/httpdocs/inc/curlInitialize.php on line 32\n', referer: https://domain/signup
The PHP code for the file is:
Code:
<?php
function curlInit($host, $login, $password)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://{$host}:8443/enterprise/control/agent.php");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("HTTP_AUTH_LOGIN: {$login}",
"HTTP_AUTH_PASSWD: {$password}",
"HTTP_PRETTY_PRINT: TRUE",
"Content-Type: text/xml")
);
return $curl;
}
function sendRequest($curl, $packet)
{
curl_setopt($curl, CURLOPT_POSTFIELDS, $packet);
$result = curl_exec($curl);
if (curl_errno($curl)) {
$errmsg = curl_error($curl);
$errcode = curl_errno($curl);
curl_close($curl);
throw new ApiRequestException($errmsg, $errcode);
}
curl_close($curl);
return $result;
}
?>
Thank you