Unable to get local issuer certificate
AlexPresso opened this issue · 2 comments
AlexPresso commented
Hey there,
Having a problem while using the library on localhost:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
I've searched a way to disable SSL verification in Guzzle, but I wasn't able to find how I can pass request options to Guzzle from the HttpClient, do you have an idea ?
Here is my code:
/**
* @Rest\Post("/images")
* @Rest\FileParam(name="image", nullable=false, image=true)
* @param ParamFetcherInterface $params
*/
public function imageUpload(ParamFetcherInterface $params) {
$this->denyAccessUnlessGranted('ROLE_ADMIN');
$client = new Client();
$client->setOption("client_id", $_ENV["IMGUR_CLIENT_ID"]);
$client->setOption("client_secret", $_ENV["IMGUR_CLIENT_SECRET"]);
$test = $client->api('image')->upload(array(
'image' => $params->get('image'),
'type' => 'file'
));
print_r($test);
}
peter279k commented
After looking at the tests and source codes, It seems that you've to override the GuzzleHttp\Client
and pass this to the Imgur\Client
.
Please try following codes:
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\HandlerStack;
use Imgur\Client;
use Imgur\HttpClient\HttpClient;
//.......
$guzzleClient = new GuzzleClient([
'base_uri' => 'https://api.imgur.com/3/',
'handler' => HandlerStack::create(),
'verify' => false,
]);
$httpClient = new HttpClient([], $guzzleClient);
$client = new Client(null, $httpClient);
$client->setOption("client_id", $_ENV["IMGUR_CLIENT_ID"]);
$client->setOption("client_secret", $_ENV["IMGUR_CLIENT_SECRET"]);
//......
AlexPresso commented
You're the best, thanks :)