mydhl
1.0.0
与 MyDHL 集成的 OpenAPI 说明
该 PHP 包由 OpenAPI Generator 项目自动生成:
PHP 5.5 及更高版本
要通过 Composer 安装绑定,请将以下内容添加到composer.json
:
{
"repositories" : [
{
"type" : " vcs " ,
"url" : " https://github.com/spysystem/mydhl.git "
}
],
"require" : {
"spysystem/mydhl" : " *@dev "
}
}
然后运行composer install
下载文件并包含autoload.php
:
require_once ( ' /path/to/OpenAPIClient-php/vendor/autoload.php ' );
要运行单元测试:
composer install
./vendor/bin/phpunit
请按照安装过程操作,然后运行以下命令:
<?php
require_once ( __DIR__ . ' /vendor/autoload.php ' );
// Configure HTTP basic authorization: BasicAuth
$ config = MyDHL Configuration :: getDefaultConfiguration ()
-> setUsername ( ' YOUR_USERNAME ' )
-> setPassword ( ' YOUR_PASSWORD ' );
$ apiInstance = new MyDHL Api DHLClientApi (
// If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
// This is optional, `GuzzleHttpClient` will be used as default.
new GuzzleHttp Client (),
$ config
);
$ data = new MyDHL Model RateRequestRequest (); // MyDHLModelRateRequestRequest | Rate Request Data
try {
$ result = $ apiInstance -> requestRate ( $ data );
print_r ( $ result );
} catch ( Exception $ e ) {
echo ' Exception when calling DHLClientApi->requestRate: ' , $ e -> getMessage (), PHP_EOL ;
}
?>
所有 URI 均相对于https://wsbexpress.dhl.com/rest/sndpt
班级 | 方法 | HTTP请求 | 描述 |
---|---|---|---|
DHL客户端API | 请求率 | 发布/费率请求 | 请求运费 |
DHL客户端API | 请求发货 | 邮寄/装运请求 | 创建货件 |
托马斯@spysystem.dk