PHP Ebay SDK SSL证书

编程入门 行业动态 更新时间:2024-10-10 04:23:33
本文介绍了PHP Ebay SDK SSL证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在使用 ebay-sdk-php ,而我试图使这个工作。我没有使用任何SSL握手。我的代码基本上在XAMPP Server上运行,仅用于说明目的。代码如下-

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 * * www.apache/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 \DTS\eBaySDK\Constants; use \DTS\eBaySDK\Trading\Services; use \DTS\eBaySDK\Trading\Types; use \DTS\eBaySDK\Trading\Enums; /** * Create the service object. */ $service = new Services\TradingService([ 'credentials' => $config['production']['credentials'], 'siteId' => Constants\SiteIds::US ]); /** * Create the request object. */ $request = new Types\GetFeedbackRequestType(); /** * 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 Types\CustomSecurityHeaderType(); $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: %s\n%s\n\n", $error->SeverityCode === Enums\SeverityCodeType::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: %s\n", $feedback->CommentingUser, $feedback->ItemTitle, $feedback->CommentTime->format('d-m-Y H:i'), $feedback->CommentText ); } }

我收到此错误-

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

rs.html)

推荐答案

正确的方法是使用验证配置选项以禁用SSL / TLS证书验证。显然不要对生产代码执行此操作。

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 Services\TradingService([ 'credentials' => $config['production']['credentials'], 'siteId' => Constants\SiteIds::US, 'httpOptions' => [ 'verify' => false ] ]);

更多推荐

PHP Ebay SDK SSL证书

本文发布于:2023-06-05 23:14:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/529893.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:证书   Ebay   PHP   SSL   SDK

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!