showbw() ---Fatal error: Uncaught exception 'Exception' with message 'curl_exec threw error "

275 views Asked by At

I updated my WHM 11.50.0.10 yesterday, I use Xmlapi API to manage my bills, gave error band (Traffic) use the showbw () function. I do not know what happened now no longer works. See the error!

Fatal error: Uncaught exception 'Exception' with message 'curl_exec threw error "" for https://000.000.000.00:2087/xml-api/showbw?' in /home/controle/public_html/conseld/Servidor/xmlapi.php:759 Stack trace: #0 /home/controle/public_html/conseld/Servidor/xmlapi.php(676): xmlapi->curl_query('https://000.000...', '', 'Authorization: ...') #1 /home/controle/public_html/conseld/Servidor/xmlapi.php(2136): xmlapi->xmlapi_query('showbw') #2 /home/controle/public_html/conseld/InformacaoConta/informacao.php(175): xmlapi->showbw() #3 /home/controle/public_html/conseld/ListarConta/fullTab.php(175): include_once('/home/controle/...') #4 {main} thrown in /home/controle/public_html/conseld/Servidor/xmlapi.php on line 7

Error line (759) file -->xmlapi.php

throw new Exception("curl_exec threw error \"" . curl_error($curl) . "\" for " . $url . "?" . $postdata );

private function curl_query( $url, $postdata, $authstr )
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
// Return contents of transfer on curl_exec
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// Allow self-signed certs
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
// Set the URL
curl_setopt($curl, CURLOPT_URL, $url);
// Increase buffer size to avoid "funny output" exception
curl_setopt($curl, CURLOPT_BUFFERSIZE, 131072);

// Pass authentication header
$header[0] =$authstr .
"Content-Type: application/x-www-form-urlencoded\r\n" .
"Content-Length: " . strlen($postdata) . "\r\n" . "\r\n" . $postdata;

curl_setopt($curl, CURLOPT_HTTPHEADER, $header);

//curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_POST, 1);

$result = curl_exec($curl);
if ($result == false) {
throw new Exception("curl_exec threw error \"" . curl_error($curl) . "\" for " . $url . "?" . $postdata );
}
curl_close($curl);

return $result;
}

Error line (2136) file -->xmlapi.php
return $this->xmlapi_query('showbw', $args);

public function showbw($args = null)
{
if (is_array($args)) {
return $this->xmlapi_query('showbw', $args);
}

return $this->xmlapi_query('showbw');
}

public function nvset($key, $value)
{
if (!isset($key) || !isset($value)) {
error_log("nvset requires that key and value are passed to it");

return false;
}

return $this->xmlapi_query('nvset', array('key' => $key, 'value' => $value));
}

Error line (676) file -->xmlapi.php

$response = $this->curl_query($url, $args, $authstr);

$response = NULL;
if ($this->http_client == 'curl') {
$response = $this->curl_query($url, $args, $authstr);
} elseif ($this->http_client == 'fopen') {
$response = $this->fopen_query($url, $args, $authstr);
}

Error line informacao.php(175): xmlapi->showbw()

$xml1 = simplexml_load_string($accounts1);

$accounts1 = $xmlapi->showbw();
$xml1 = simplexml_load_string($accounts1);
$expression1 = sprintf("/*/bandwidth/acct[contains(user, '".$_SESSION["gravaUser"]."')]", $_SESSION["gravaUser"]);
$result1 = $xml1->xpath($expression1);

Was running after this update is not working. Could someone help me

0

There are 0 answers