gpt4 book ai didi

php - Bigcommerce SSL 问题

转载 作者:太空宇宙 更新时间:2023-11-03 15:02:08 25 4
gpt4 key购买 nike

我有以下代码:

<?php
error_reporting(E_ALL);
ini_set('display_errors', True);
require 'bigcommerce.php';
use Bigcommerce\Api\Client as Bigcommerce;


Bigcommerce::configure(array(
'store_url' => 'Our URL is here and valid',
'username' => 'Our username is here and valid',
'api_key' => 'Our key is here and valid'
));

Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);

$products = Bigcommerce::getProducts();

foreach($products as $product) {
echo $product->name;
echo $product->price;
}
?>

当我运行它时,我得到以下输出:

Fatal error: Uncaught exception 'Bigcommerce\Api\NetworkError' with message 'SSL peer     certificate or SSH remote key was not OK' in /home/zetaphor/public_html/bigcommerce-api-php-master/bigcommerce.php:82 Stack trace: #0 /home/zetaphor/public_html/bigcommerce-api-php-master/bigcommerce.php(142): Bigcommerce\Api\Connection->handleResponse() #1 /home/zetaphor/public_html/bigcommerce-api-php-master/bigcommerce.php(333): Bigcommerce\Api\Connection->get('https://store-9...') #2 /home/zetaphor/public_html/bigcommerce-api-php-master/bigcommerce.php(408): Bigcommerce\Api\Client::getCollection('/products', 'Product') #3 /home/zetaphor/public_html/bigcommerce-api-php-master/coupons.php(17): Bigcommerce\Api\Client::getProducts() #4 {main} thrown in /home/zetaphor/public_html/bigcommerce-api-php-master/bigcommerce.php on line 82

最佳答案

看来我自己弄明白了。

必须将以下两行添加到 Bigcommerce.php 的构造函数(API 的单文件版本)

curl_setopt( $this->curl, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt( $this->curl, CURLOPT_SSL_VERIFYPEER, 0 );

这确实存在一些安全问题,但此文件将在本地运行以生成一次性报告。

关于php - Bigcommerce SSL 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20229723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com