PHP Ebay SDK SSL证书
我一直在使用这个,我正在努力使它工作。我没有使用任何SSL握手。我的代码在XAMPP服务器上运行,基本上是为了演示。代码如下-PHP Ebay SDK SSL证书,php,ebay-api,Php,Ebay Api,我一直在使用这个,我正在努力使它工作。我没有使用任何SSL握手。我的代码在XAMPP服务器上运行,基本上是为了演示。代码如下- <?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
<?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 \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
);
}
}
(rs.html)要解决此问题,请在此文件夹中的文件中- 供应商\guzzle http\guzzle\src 我们需要改变这个数组-
$defaults = [
'allow_redirects' => RedirectMiddleware::$defaultSettings,
'http_errors' => true,
'decode_content' => true,
'verify' => true,
'cookies' => false
];
进入
正确的方法是使用配置选项禁用SSL/TLS证书验证。显然,不要对生产代码执行此操作
$service = new Services\TradingService([
'credentials' => $config['production']['credentials'],
'siteId' => Constants\SiteIds::US,
'httpOptions' => [
'verify' => false
]
]);
不需要更改SDK的代码。您可以传递配置选项。
$defaults = [
'allow_redirects' => RedirectMiddleware::$defaultSettings,
'http_errors' => true,
'decode_content' => true,
'verify' => false,
'cookies' => false
];
$service = new Services\TradingService([
'credentials' => $config['production']['credentials'],
'siteId' => Constants\SiteIds::US,
'httpOptions' => [
'verify' => false
]
]);