我们正在将我们的产品在n11中与XML集成。我们用php SOAP完成它们。
我们在本地或通过服务器以两种方式进行产品更新操作。当我们在本地执行这些操作时,我们没有遇到问题。但是,当我们尝试通过服务器实现它时,我们遇到了一个"无法连接到主机"错误。当我们尝试使用单个API密钥作为单个cron时,我们在更新了大约100个产品后会出现此错误。当我们尝试5个不同的api密钥和5个不同的cron时,大约有10-20个项目被更新,然后我们再次得到相同的错误。
我们无法在2周内解决此错误。
我们已经实施了本网站或其他网站中提到的大多数解决方案。我们尝试过这些页面中提到的缓存更改和域名解析等方法。还有其他一些事情。
然后...... 我们比较了本地和服务器的phpinfo值。我们收到服务器服务的专家已经改变了这些差异。但是我们又犯了同样的错误。
由于这些中断,5万次产品更新可能需要数小时。 我们是否有软件缺点或要求您告诉我们服务器端要更改的设置。我们请您帮忙。
SOAP连接
<?php
/**
*
*/
class n11 {
protected static $_appKey, $_appSecret, $_parameters, $_sclient;
public $_debug = false;
public function __construct(array $attributes = array()) {
self::$_appKey = $attributes['appKey'];
self::$_appSecret = $attributes['appSecret'];
self::$_parameters = ['auth' => ['appKey' => self::$_appKey, 'appSecret' => self::$_appSecret]];
}
public function setUrl($url) {
self::$_sclient = new \SoapClient($url);
}
public function GetTopLevelCategories() {
$this->setUrl('https://api.n11.com/ws/CategoryService.wsdl');
return self::$_sclient->GetTopLevelCategories(self::$_parameters);
}
public function GetSubCategories($categoryId) {
$this->setUrl('https://api.n11.com/ws/CategoryService.wsdl');
self::$_parameters['categoryId'] = $categoryId;
return self::$_sclient->GetSubCategories(self::$_parameters);
}
public function GetCities() {
$this->setUrl('https://api.n11.com/ws/CityService.wsdl');
return self::$_sclient->GetCities(self::$_parameters);
}
public function GetProductList($itemsPerPage, $currentPage) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['pagingData'] = ['pageSize' => $itemsPerPage, 'currentPage' => $currentPage];
return self::$_sclient->GetProductList(self::$_parameters);
}
public function GetCategoryAttributes($categoryId) {
$this->setUrl('https://api.n11.com/ws/CategoryService.wsdl');
self::$_parameters['categoryId'] = $categoryId;
return self::$_sclient->GetCategoryAttributes(self::$_parameters);
}
public function GetProductByProductId($productId) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['productId'] = $productId;
return self::$_sclient->GetProductByProductId(self::$_parameters);
}
public function GetProductBySellerCode($sellerCode) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['sellerCode'] = $sellerCode;
return self::$_sclient->GetProductBySellerCode(self::$_parameters);
}
public function StopSellingProductByProductId($productId) {
$this->setUrl('https://api.n11.com/ws/ProductSellingService.wsdl');
self::$_parameters['productId'] = $productId;
return self::$_sclient->StopSellingProductByProductId(self::$_parameters);
}
public function SaveProduct(array $product = Array()) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['product'] = $product;
return self::$_sclient->SaveProduct(self::$_parameters);
}
public function UpdateProductPriceBySellerCode($productSellerCode, $price) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['productSellerCode'] = $productSellerCode;
self::$_parameters['price'] = $price;
self::$_parameters['currencyType'] = 1;
self::$_parameters['stockItems'] = [
'stockItem' => [
'sellerStockCode' => '',
'optionPrice' => $price
]
];
return self::$_sclient->UpdateProductPriceBySellerCode(self::$_parameters);
}
public function UpdateProductPriceById($productId, $price) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['productId'] = $productId;
self::$_parameters['price'] = $price;
self::$_parameters['currencyType'] = 1;
self::$_parameters['stockItems'] = [
'stockItem' => [
'sellerStockCode' => '',
'optionPrice' => $price
]
];
return self::$_sclient->UpdateProductPriceById(self::$_parameters);
}
public function UpdateStockByStockId($stockItem) {
$this->setUrl('https://api.n11.com/ws/ProductStockService.wsdl');
self::$_parameters['stockItems'] = [
'stockItem' => $stockItem
];
return self::$_sclient->UpdateStockByStockId(self::$_parameters);
}
public function UpdateProductBasic(array $product = Array()) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
foreach ($product as $key => $value) {
self::$_parameters[$key] = $value;
}
return self::$_sclient->UpdateProductBasic(self::$_parameters);
}
public function GetProductStockByProductId($productId) {
$this->setUrl('https://api.n11.com/ws/ProductStockService.wsdl');
self::$_parameters['productId'] = $productId;
return self::$_sclient->GetProductStockByProductId(self::$_parameters);
}
public function DeleteProductBySellerCode($sellerCode) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['productSellerCode'] = $sellerCode;
return self::$_sclient->DeleteProductBySellerCode(self::$_parameters);
}
public function UpdateDiscountValueByProductId($productId, $productDiscount) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['productId'] = $productId;
self::$_parameters['productDiscount'] = $productDiscount;
return self::$_sclient->UpdateDiscountValueByProductId(self::$_parameters);
}
public function OrderList(array $searchData = Array()) {
$this->setUrl('https://api.n11.com/ws/OrderService.wsdl');
self::$_parameters['searchData'] = $searchData;
return self::$_sclient->OrderList(self::$_parameters);
}
public function __destruct() {
if ($this->_debug) {
print_r(self::$_parameters);
}
}
}
&GT;
当地的phpinfo; http://213.159.7.86/~kongoru/local.html
服务器phpinfo http://213.159.7.86/~kongoru/deneme.php