Hello,
I am trying to make a cURL request from an app i am developing to localhost but each HTTP request i make returns a cURL error 7. Same problem while trying with the iClient’s post method. I tried whitelisting the HTTP request’s target URL but it does not seem to fix the issue. Is there a firewall preventing cURL requests from being fired ?
I am running Nextcloud in a docker container.
My cURL function :
public function testConnection(string $UserId) {
$completeConfig = $this->completeConfig($UserId);
$iClient = $this->IClientService->newClient();
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_URL, "http://localhost:8000/plugin");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $completeConfig);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
if($response === false){
throw new Exception(curl_error($ch), curl_errno($ch));
}
return $response;
}
catch(Exception $e) {
trigger_error(sprintf('Curl failed with error #%d: %s', $e->getCode(), $e->getMessage()), E_USER_ERROR);
}
finally {
if(is_resource($ch)){
curl_close($ch);
}
}
}
My current config.php:
<?php
$CONFIG = array(
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array(
0 =>
array(
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array(
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'passwordsalt' => 'qq35/QHKLb3SYzjkVp9tIiNtPRVaa1',
'secret' => '6u5OBS/o4LuNLmIW80nboSIw/g3VI/jrwUaUkYxRFZjhIeMl',
'trusted_domains' =>
array(
0 => 'localhost',
1 => 'http://localhost:8000/plugin'
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'sqlite3',
'version' => '24.0.5.1',
'dbname' => 'nextcloud.db',
'installed' => true,
'instanceid' => 'ocvxi5l66jxm',
'allow_local_remote_servers' => true,
'theme' => '',
'loglevel' => 2,
'debug' => true,
'maintenance' => false,
);
Thank you for your help