hocza/shoprenter-api

此包最新版本(dev-master)没有提供许可证信息。

ShopRenter API 的 PHP 客户端

dev-master 2022-11-11 12:56 UTC

This package is not auto-updated.

Last update: 2024-09-14 20:45:54 UTC


README

用法

<?php

require_once 'vendor/autoload.php';

use ShopRenter\ApiCall;

$settings = [
    'username' => '[USERNAME]',
    'api_key' => '[APIKEY]',
    'url' => '[SHOPNAME].api.shoprenter.hu',
];

$apiCall = new ApiCall($settings['username'], $settings['api_key']);

$apiCall->setFormat('json');

try {
    $response = $apiCall->execute('GET', $settings['url'] . '/products');

    echo '<pre>';
    print_r($response->getParsedResponseBody());
    echo '</pre>';
} catch (Exception $exception) {
    echo 'Something bad happened...';
}

POST 请求

$apiCall->execute('POST', $url, ['sku' => 'something', 'price' => 1000]);

DELETE 请求

$apiCall->execute('DELETE', $url);

支持的 HTTP 方法

  • GET
  • POST
  • PUT
  • DELETE