Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get local issuer certificate #33

Closed
AlexPresso opened this issue Dec 4, 2020 · 2 comments
Closed

Unable to get local issuer certificate #33

AlexPresso opened this issue Dec 4, 2020 · 2 comments

Comments

@AlexPresso
Copy link

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
Copy link
Contributor

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
Copy link
Author

You're the best, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants