1. Go to this page and download the library: Download sparkproxy/spark-sdk-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sparkproxy / spark-sdk-php example snippets
use SparkProxy\Auth;
use SparkProxy\Config;
use SparkProxy\Open\SparkProxyClient;
$supplierNo = 'test0001';
$secretKey = 'qwertyuiop123456op123456';
$auth = new Auth($supplierNo, $secretKey);
$client = new SparkProxyClient($auth, Config::QA_API_HOST);
list($ret, $err) = $client->getProductStock(103);
if ($err == null) {
if (count($ret['data']) > 1) {
$product = $ret['data'][1];
list($ret, $err) = $client->createProxy("test_240518_03", $product["productId"], 2,
$product["duration"] * 2, $product["unit"], $product["countryCode"], $product["areaCode"], $product["cityCode"]);
if ($err !== null) {
var_dump($err);
exit;
}
list($ret, $err) = $client->getOrder($ret['data']["reqOrderNo"]);
var_dump($ret);
var_dump($err);
}
}
bash
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.