PHP code example of lun324 / open-api-sdk-php
1. Go to this page and download the library: Download lun324/open-api-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/ */
lun324 / open-api-sdk-php example snippets
$appKey = "<您从福禄开放平台获得的appKey>"; ;
$appSecret = "<您从福禄开放平台获得的appSecret>";
$method = "<您需要调用的接口:从接口地址常量获取>" ;
// 初始化客户端
$defaultOpenApiClient = new DefaultOpenApiClient($apiGateway, $appKey, $appSecret, $method);
$request = new InputDirectOrderDto();
$request->customerOrderNo = '20191230142306472' . time();
$request->productId = 10000585;
$request->buyNum = 1;
$request->chargeAccount = '888888';
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputCardOrderDto();
$request->customerOrderNo = '20191230142306472' . time();
$request->productId = '10000587';
$request->buyNum = 1;
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputPhoneOrderDto();
$request->customerOrderNo = '20191230142306472' . time();
$request->chargePhone = '15972368779';
$request->chargeValue = 50;
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputOrderGetDto();
$request->customerOrderNo = '201912301423064721578987416';
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputProductListDto();
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputProductDto();
$request->productId = '10000587';
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputProductTemplateDto();
$request->templateId = '10000587';
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputUserDto();
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputTrafficOrderDto();
$request->customerOrderNo = '20191230142306472' . time();
$request->chargePhone = '15972368779';
$request->chargeValue = 1024;
$request->packetKind = 4;
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);
$request = new InputMatchPhoneProductListDto();
$request->phone = '15972368779';
$defaultOpenApiClient->setBizObject($request);
$result = $defaultOpenApiClient->excute();
print_r($result);