Happyr / LinkedIn-API-client

A library to connect with LinkedIn API. Perfect if you are looking for an API client or SDK for LinkedIn
MIT License
198 stars 97 forks source link

Disable CURLOPT_SSL_VERIFYPEER #132

Closed Ridder90 closed 7 years ago

Ridder90 commented 8 years ago

Bug? no New Feature? no Are you using composer? yes

Hi! I'm trying to use this client. Unfortunatly i keep getting a fatal error because of my self signed certificate.

Uncaught GuzzleHttp\Ring\Exception\RingException: cURL error 60: SSL certificate problem

I know you should be able to disable the verify peer option. What i have tried is.

$guzzleClient = new \GuzzleHttp\Client(array( 'curl' => array( CURLOPT_SSL_VERIFYPEER => false, ), )); $li->setHttpClient($guzzleClient);

and

$guzzle = new Http\Adapter\Guzzle5\Client(['curl' => array( CURLOPT_SSL_VERIFYPEER => false ) ]); $li->setHttpClient($guzzle);

which gives me Class 'Http\Adapter\Guzzle6\Client' not found or paramater must be instance of GuzzleHttp\ClientInterface.

Please advice.

Nyholm commented 8 years ago

Have a look at the HTTPlug documentation: http://docs.php-http.org/en/latest/clients/guzzle5-adapter.html#usage

You need to create the Guzzle client and configure it. Then you need the Guzzle5 adapter. Also, it seams that you are mixing Guzzle versions. Decide if you want to use Guzzle5 or Guzzle6.

Ridder90 commented 7 years ago

Hi and thanks for you response! I forgot to answer you...I ended up with hardcoding the verifiypeer to false on my local environment. Still getting "paramater must be instance of GuzzleHttp\ClientInterface message". Even after following the docs.

ghost commented 7 years ago

For future reference here is what you should do:

$linkedIn = new Happyr\LinkedIn\LinkedIn('client_id', 'client_secret');
$linkedIn->setHttpClient(new \Http\Adapter\Guzzle6\Client(new \GuzzleHttp\Client(['curl' => [CURLOPT_SSL_VERIFYPEER => false ]])));

You basically need to create a Client instance, pass it to the Client Adapter instance and pass that into the LinkedIn instance.

Why? because composition. This whole Guzzle thing is a mess!

Nyholm commented 7 years ago

This is now a part of HTTPlugs documentation. http://docs.php-http.org/en/latest/clients/guzzle6-adapter.html