skip to Main Content

Good morning,

I work locally on Wampserver and I want to access an API locally.

So it gives me this error:

( ! ) Fatal error: Uncaught GuzzleHttpExceptionRequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/now_playing?language=fr-FR&page=1&region=FR in C:wamp64wwwsitesmon-sitelibraryvendorguzzlehttpguzzlesrcHandlerCurlFactory.php on line 211
( ! ) GuzzleHttpExceptionRequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/now_playing?language=fr-FR&page=1&region=FR in C:wamp64wwwsitesmon-sitelibraryvendorguzzlehttpguzzlesrcHandlerCurlFactory.php on line 211
Call Stack
# Time Memory Function Location
1 0.0006 364568 {main}( ) …API-now_playing.php:0
2 0.0041 375984 GuzzleHttpClient->request( $method = ‘GET’, $uri = ‘https://api.themoviedb.org/3/movie/now_playing?language=fr-FR&page=1&region=FR’, $options = [‘headers’ => [‘Authorization’ => ‘Bearer ey[…]HU’, ‘accept’ => ‘application/json’]] ) …API-now_playing.php:7
3 0.1871 414024 GuzzleHttpPromiseRejectedPromise->wait( $unwrap = ??? ) …Client.php:189

I therefore understood that the error comes from the fact that locally I do not have an SSL certificate.
What can I do to fix this error?
Is it possible to install a certificate locally? If yes, how to proceed?

Thank you for your time and your response.

I have this code below which works on server but not locally.“`php

<?php
 
require_once('../../library/vendor/autoload.php');
 
$client = new GuzzleHttpClient();
 
$response = $client->request('GET', 'https://api.themoviedb.org/3/movie/now_playing?language=fr-FR&page=1&region=FR', [
    'headers' => [
        'Authorization' => 'Bearer ey[...]HU',
        'accept' => 'application/json',
    ],
]);
 
$rep = $response->getBody();
echo $rep;
 
?>

2

Answers


  1. Chosen as BEST ANSWER

    Thank you for your reply.

    But no solution works. The first returns:

    ( ! ) Fatal error: Uncaught Error: Class "RequestOptions" not found in C:wamp64wwwsitesmon-sitephpAPIAPI-now_playing.php on line 13
    ( ! ) Error: Class "RequestOptions" not found in C:wamp64wwwsitesmon-sitephpAPIAPI-now_playing.php on line 13
    Call Stack
    # Time Memory Function Location
    1 0.0002 366720 {main}( ) ...API-now_playing.php:0

    <?php
    
    require_once('../../library/vendor/autoload.php');
    
    $client = new GuzzleHttpClient();
    
    $response = $client->request('GET', 'https://api.themoviedb.org/3/movie/now_playing?language=fr-FR&page=1&region=FR', [
        RequestOptions::VERIFY => false,
        'headers' => [
            'Authorization' => 'Bearer ey[...]HU',
            'accept' => 'application/json',
        ],
    ]);
    
    $rep = $response->getBody();
    echo $rep;
    
    ?>

    The second returns:

    ( ! ) Fatal error: Uncaught Error: Class "Client" not found in C:wamp64wwwsitesmon-sitephpAPIAPI-now_playing.php on line 6
    ( ! ) Error: Class "Client" not found in C:wamp64wwwsitesmon-sitephpAPIAPI-now_playing.php on line 6
    Call Stack
    # Time Memory Function Location
    1 0.0006 364880 {main}( ) ...API-now_playing.php:0

    <?php
    
    require_once('../../library/vendor/autoload.php');
    
    $client = new GuzzleHttpClient();
    $client = new Client(['verify' => false]);
    
    $response = $client->request('GET', 'https://api.themoviedb.org/3/movie/now_playing?language=fr-FR&page=1&region=FR', [
        'headers' => [
            'Authorization' => 'Bearer ey[...]HU',
            'accept' => 'application/json',
        ],
    ]);
    
    $rep = $response->getBody();
    echo $rep;
    
    ?>

    Do you have another solution?

    EDIT : I'm sorry It's good !

    The final code:

    <?php
    
    require_once('../../library/vendor/autoload.php');
    
    $client = new GuzzleHttpClient(['verify' => false]);
    
    $response = $client->request('GET', 'https://api.themoviedb.org/3/movie/now_playing?language=fr-FR&page=1&region=FR', [
        'headers' => [
            'Authorization' => 'Bearer ey[...]HU',
            'accept' => 'application/json',
        ],
    ]);
    
    $rep = $response->getBody();
    echo $rep;
    
    ?>

    Thank you for your reply !


  2. If you work locally you can just disable ssl verification inside your request. I hope one of these should work.

    $response = $client->request('GET', 'https://example.com', [
    RequestOptions::VERIFY => false,
    ]);
    

    Or

    $client = new Client(['verify' => false]);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search