skip to Main Content

I have been using this ebay-sdk-php and I am trying to make this working. I am not using any SSL handshake. My code is running on XAMPP Server basically for illustration purposes. The code is as below-

<?php
/**
 * Copyright 2016 Luca Accomazzi and David T. Sadler
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Include the SDK by using the autoloader from Composer.
 */
require __DIR__.'/../vendor/autoload.php';

/**
 * Include the configuration values.
 *
 * Ensure that you have edited the configuration.php file
 * to include your application keys.
 */
$config = require __DIR__.'/../configuration.php';

/**
 * The namespaces provided by the SDK.
 */
use DTSeBaySDKConstants;
use DTSeBaySDKTradingServices;
use DTSeBaySDKTradingTypes;
use DTSeBaySDKTradingEnums;

/**
 * Create the service object.
 */

$service = new ServicesTradingService([
    'credentials' => $config['production']['credentials'],
    'siteId'      => ConstantsSiteIds::US

]);

/**
 * Create the request object.
 */
$request = new TypesGetFeedbackRequestType();

/**
 * An user token is required when using the Trading service.
 *
 * NOTE: eBay will use the token to determine which store to return.
 */
$request->RequesterCredentials = new TypesCustomSecurityHeaderType();
$request->RequesterCredentials->eBayAuthToken = $config['production']['authToken'];

/**
 * By specifying 'Positive' we are telling the API return only positive reviews.
 */
$request->CommentType = ['Positive'];

/**
 * By specifying 'ReturnAll' we are telling the API return the full reviews.
 */
$request->DetailLevel = ['ReturnAll'];

/**
 * Send the request.
 */
$response = $service->getFeedback($request);

/**
 * Output the result of calling the service operation.
 */
if (isset($response->Errors)) {
    foreach ($response->Errors as $error) {
        printf(
            "%s: %sn%snn",
            $error->SeverityCode === EnumsSeverityCodeType::C_ERROR ? 'Error' : 'Warning',
            $error->ShortMessage,
            $error->LongMessage
        );
    }
}

if ($response->Ack !== 'Failure') {
    foreach ($response->FeedbackDetailArray->FeedbackDetail as $feedback) {
        printf(
            "User %s bought %s on %s. Comment: %sn",
            $feedback->CommentingUser,
            $feedback->ItemTitle,
            $feedback->CommentTime->format('d-m-Y H:i'),
            $feedback->CommentText
        );
    }
}

And I am getting this error-

PHP Fatal error:  Uncaught GuzzleHttpExceptionRequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-erro

rs.html)

2

Answers


  1. To solve this issue, In this Client.php file that will essentially reside in this folder-

    vendorguzzlehttpguzzlesrc

    we need to change this array-

     $defaults = [
            'allow_redirects' => RedirectMiddleware::$defaultSettings,
            'http_errors'     => true,
            'decode_content'  => true,
            'verify'          => true,
            'cookies'         => false
        ];
    

    into

    $defaults = [
            'allow_redirects' => RedirectMiddleware::$defaultSettings,
            'http_errors'     => true,
            'decode_content'  => true,
            'verify'          => false,
            'cookies'         => false
        ];
    
    Login or Signup to reply.
  2. The correct way is to use the verify configuration option to disable SSL/TLS certificate verification. Obviously don’t do this for production code.

    $service = new ServicesTradingService([
        'credentials' => $config['production']['credentials'],
        'siteId'      => ConstantsSiteIds::US,
        'httpOptions' => [
            'verify' => false
         ]    
    ]);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search