Code Monkey home page Code Monkey logo

openapi-sdk-php's Introduction

English | 简体中文

Alibaba Cloud SDK for PHP

Latest Stable Version composer.lock Total Downloads License codecov Travis Build Status Appveyor Build Status

AlibabaCloud

Alibaba Cloud SDK for PHP is a development kit that supports quick access to products, dependency on Alibaba Cloud Client for PHP.

Release Notes

We developed a new kernel on the principle of eliminating known issues and compatible with old grammar, adding the following features:

Prerequisites

Your system will need to meet the Prerequisites, including having PHP >= 5.5. We highly recommend having it compiled with the cURL extension and cURL 7.16.2+.

Installation

If Composer is already installed globally on your system, run the following in the base directory of your project to install Alibaba Cloud SDK for PHP as a dependency:

composer require alibabacloud/sdk

Please see the Installation for more detailed information about installing through Composer and other ways.

Troubleshoot

Troubleshoot Provide OpenAPI diagnosis service to help developers locate quickly and provide solutions for developers through RequestID or error message.

Online Demo

Alibaba Cloud OpenAPI Developer Portal provides the ability to call the cloud product OpenAPI online, and dynamically generate SDK Example code and quick retrieval interface, which can significantly reduce the difficulty of using the cloud API.

Quick Examples

Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your Credentials. Before request, please Understanding the Clients, after request, please Understanding the Result.

Currently, only some Alibaba Cloud products are supported, Supported Products, For products that are not supported, you can use Alibaba Cloud Client for PHP to initiate custom requests, and you can use Alibaba Cloud OpenAPI Developer Portal to generate Alibaba Cloud Client for PHP code online.

<?php

use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;
use AlibabaCloud\Ecs\Ecs;

// Set up a global client
AlibabaCloud::accessKeyClient('foo', 'bar')
            ->regionId('cn-hangzhou')
            ->asDefaultClient();

try {
    // Access product APIs
    $request = Ecs::v20140526()->describeRegions();
    
    // Set options/parameters and execute request
    $result = $request->withResourceType('type') // API parameter
                      ->withInstanceChargeType('type') // API parameter
                      ->client('client1') // Specify the client for send
                      ->debug(true) // Enable the debug will output detailed information
                      ->connectTimeout(0.01) // Throw an exception when Connection timeout 
                      ->timeout(0.01) // Throw an exception when timeout 
                      ->request(); // Execution request

    // Can also Set by passing in an array
    $options = [
                   'debug'           => true,
                   'connect_timeout' => 0.01,
                   'timeout'         => 0.01,
                   'query'           => [
                       'ResourceType' => 'type',
                       'InstanceChargeType' => 'type',
                   ],
               ];
    
    // Settings priority
    $result2 = Ecs::v20140526()
                  ->describeRegions($options)
                  ->options([
                                'query' => [
                                    'Key'      => 'I will overwrite this value in constructor',
                                    'new'      => 'I am new value',
                                ],
                            ])
                  ->options([
                                'query' => [
                                    'Key' => 'I will overwrite the previous value',
                                    'bar' => 'I am new value',
                                ],
                            ])
                  ->debug(false) // Overwrite the true of the former
                  ->request();
    
} catch (ClientException $exception) {
    echo $exception->getMessage(). PHP_EOL;
} catch (ServerException $exception) {
    echo $exception->getMessage() . PHP_EOL;
    echo $exception->getErrorCode(). PHP_EOL;
    echo $exception->getRequestId(). PHP_EOL;
    echo $exception->getErrorMessage(). PHP_EOL;
}

Issues

Opening an Issue, Issues not conforming to the guidelines may be closed immediately.

Changelog

Detailed changes for each release are documented in the release notes.

Contribution

Please make sure to read the Contributing Guide before making a pull request.

References

License

Apache-2.0

Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

openapi-sdk-php's People

Contributors

aliguyong avatar jacksontian avatar sdk-team avatar yndu13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openapi-sdk-php's Issues

NLS接口报错

  • PHP 版本:7.1
  • 平台:CentOS
  • 产品名称
  • 产品版本
  • API
        try {
            //
            $result = AlibabaCloud::nlsFiletrans()->v20180817()
                ->submitTask()
                ->withTask($param)
                ->request();
            // 提交成功
            if (trim($result['StatusText']) == 'SUCCESS') {
                // 返回
                return Helper::returnError(0, [
                    'task_id' => trim($result['TaskId'])
                ]);
            }
        } catch (ClientException $e) {
            // 客户端异常
            return Helper::returnError(1000, [], $e->getErrorMessage());
        } catch (ServerException $e) {
            // 服务端异常
            return Helper::returnError(1000, [], $e->getErrorMessage());
        }

报错:

Client 'default' not found

带空字符串参数的请求会出现签名错误

  • PHP 版本:7.1-7.4
  • 平台:Linux
  • 产品名称:Vod视频点播
  • 产品版本:1.8.413
  • API:任何API
$query = [
  'Title' => 'Title',
  'Description' => '', // 只要是空的就会报签名错误
  'FileName' => 'test.mp4',
];
$request = Vod::v20170321()->createUploadVideo([
  'query' => $query,
])->endpoint($endpoint)
  ->request();

当手动降级alibabacloud/client版本到1.5.24后问题才能修复

内容安全 自定义文本库使用方式?

  • PHP Version: PHP 7.3.21-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:44:10) ( NTS )
  • Platform: Linux d0aa2e73b694 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Product: Green
  • Product Version: 20180509
  • API: getSimilarityLibrary addSimilarityLibrary

您好,我想问下,内容安全 SDK ,创建自定义文本库。是否是 getSimilarityLibrary() 方法。我通过此方法返回状态码 200 , 但是云盾控制台似乎没有?还是说,通过接口创建的文本库在控制台看不到?

另外,我通过 getSimilarityLibrary 获取报错。

$body = [
            'ServiceModule' => 'open_api'
        ];
$body = json_encode($body);
return \AlibabaCloud\Green\Green::v20180509()->getSimilarityLibrary()->body($body)->request()->toArray();

image

"Message": "The specified parameter \"KeyPairNames\" is not valid."

你好,我在阿里云的API可视化调试面板上使用PHP删除密钥对的时候报了一个莫名其妙的错误,我很郁闷,我觉得我的请求参数没有错,他为什么总说我填的keypairnames参数无效呢.

REQUEST:
`
<?php
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;

// Download:https://github.com/aliyun/openapi-sdk-php-client
// Usage:https://github.com/aliyun/openapi-sdk-php-client/blob/master/README-CN.md

AlibabaCloud::accessKeyClient('<accessKeyId>', '<accessSecret>')
                        ->regionId('cn-shenzhen')
                        ->asGlobalClient();

try {
    $result = AlibabaCloud::rpcRequest()
                        ->product('Ecs')
                        // ->scheme('https') // https | http
                        ->version('2014-05-26')
                        ->action('DeleteKeyPairs')
                        ->method('POST')
                        ->options([
                                        'query' => [
                                        'RegionId' => 'cn-shenzhen',
                                        'KeyPairNames' => 'aliyunhongkong',
                                        'SourceRegionId' => 'cn-shenzhen',
                                        ],
                                    ])
                        ->request();
    print_r($result->toArray());
} catch (ClientException $e) {
    echo $e->getErrorMessage() . PHP_EOL;
} catch (ServerException $e) {
    echo $e->getErrorMessage() . PHP_EOL;
}
<?php
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;

// Download:https://github.com/aliyun/openapi-sdk-php-client
// Usage:https://github.com/aliyun/openapi-sdk-php-client/blob/master/README-CN.md

AlibabaCloud::accessKeyClient('<accessKeyId>', '<accessSecret>')
                        ->regionId('cn-shenzhen')
                        ->asGlobalClient();

try {
    $result = AlibabaCloud::rpcRequest()
                        ->product('Ecs')
                        // ->scheme('https') // https | http
                        ->version('2014-05-26')
                        ->action('DeleteKeyPairs')
                        ->method('POST')
                        ->options([
                                        'query' => [
                                        'RegionId' => 'cn-shenzhen',
                                        'KeyPairNames' => 'aliyunhongkong',
                                        'SourceRegionId' => 'cn-shenzhen',
                                        ],
                                    ])
                        ->request();
    print_r($result->toArray());
} catch (ClientException $e) {
    echo $e->getErrorMessage() . PHP_EOL;
} catch (ServerException $e) {
    echo $e->getErrorMessage() . PHP_EOL;
}

`

RESPONSE:
{ "RequestId": "B43E020F-FDF8-4BF2-BC94-910105185959", "HostId": "ecs.aliyuncs.com", "Code": "InvalidKeyPairNames.ValueNotSupported", "Message": "The specified parameter \"KeyPairNames\" is not valid." }

CCS的配置有错?或者CCS的SDK还不完整?

你好,我在CCS的配置文件里面发现是这样配置的:
'ccs' => [ 'cn-hangzhou' => 'ccs.aliyuncs.com', ],
但是我在官方文档中看到的URL是这样的:https://cschat-ccs.aliyun.com/openapi/forwardMessage?tntInstId=XXX&scene=YYY&src=outerservice&timestamp=1487230487910&digest=ZZZ

域名为什么不对?

另外,官方文档中的forwardMessage、tntInstId在整个SDK中都找不到。

是不是CCS的SDK还不完整?或者是不是我哪里错了?

KMS

where is KMS sdk in this source ? this is available and how to used it ?

阿里云一键取号API报 Specified parameter Version is not valid

我这边因为项目是php5.6,不能用composer方式引入项目,所以只能去研究阿里云一键取号Api的接口参数去请求,
结果其他请求参数都没有问题,参数Version就报错,https://api.aliyun.com/new?spm=a2c4g.11186623.2.13.2fc27861OpQnPn#/?product=Dypnsapi&version=2017-05-25&api=GetMobile&params={%22RegionId%22:%22cn-hangzhou%22}&tab=DEMO&lang=PHP 这个url里面的version是填 2017-05-25,我也是填这个,结果就报错了。 想问下version参数应该怎么填
image

composer failed

各种Reading和Downloading之后...

Reading /Users/sarry/.composer/cache/repo/https---packagist.phpcomposer.com/provider-phpunit$phpunit-mock-objects.json from cache
Downloading https://repo.packagist.org/p/phpunit/phpunit-mock-objects.json
Resolving dependencies through SAT

Dependency resolution completed in 0.013 seconds
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install alibabacloud/client 1.5.9
- Conclusion: don't install alibabacloud/client 1.5.8
- Conclusion: don't install alibabacloud/client 1.5.7
- Conclusion: don't install alibabacloud/client 1.5.6
- Conclusion: don't install alibabacloud/client 1.5.5
- Conclusion: don't install alibabacloud/client 1.5.4
- Conclusion: don't install alibabacloud/client 1.5.3
- Conclusion: don't install alibabacloud/client 1.5.2
- Installation request for alibabacloud/client (locked at 1.0.23, required as ^1.0) -> satisfiable by alibabacloud/client[1.0.23].
- Conclusion: don't install alibabacloud/client 1.5.1
- alibabacloud/sdk 1.7.0 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.1 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.2 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.3 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.4 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.5 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.6 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.7 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.8 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- alibabacloud/sdk 1.7.9 requires alibabacloud/client ^1.5 -> satisfiable by alibabacloud/client[1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9].
- Conclusion: don't install alibabacloud/client 1.5.0
- Installation request for alibabacloud/sdk ^1.7 -> satisfiable by alibabacloud/sdk[1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9].

Installation failed, reverting ./composer.json to its original content.

无法获取容器镜像服务仓库列表

  • PHP 版本:7.2.6
  • 平台:docker alpine
  • 产品名称:容器镜像服务Cr
  • 产品版本:20160607
  • API:getRepoList

代码基本是拿官网文档过来后做的修改:

AlibabaCloud::accessKeyClient('xxx','xxx')->regionId('cn-hangzhou')->asDefaultClient();

try {
	$options = [
	    'debug' => true,
	    'query' => [
	        'Status' => 'NORMAL',
	        'RepoNamePrefix' => ''
	    ]
	];
	$request = Cr::v20160607()
	            ->getRepoList($options);

	$r = $request->request();
} catch (ServerException $e) {
    echo $e->getResult();
}

最后捕获打出来的结果是:

{"RequestId":"806D70E8-32B0-4F18-8C8A-CA54E5D22E2E","HostId":"location.aliyuncs.com","Code":"Illegal Parameter","Message":"Please check the parameters"}

不清楚是哪里参数有误。
而且API文档https://help.aliyun.com/document_detail/72399.html 上还有个RepoNamePrefix参数,要求是必须提供该参数,但SDK中又没有AlibabaCloud\Cr\V20160607\GetRepoList::withRepoNamePrefix()这样的函数,所以我通过options['query']进行了传递,不知道是否正确。

accessKeyId和accessKeySecret都是正确的
到底哪里出现了参数错误?

图像搜索一直:MissingInstanceName: InstanceName is mandatory for this action.

使用图像搜索,反复确认过instanceName,还用instanceId进行过测试,均有这个问题。运维用python测试可以。

代码如下:

        $instanceName = 'my-instance-name';

        $content = file_get_contents(storage_path("app/02.jpg"));

        AlibabaCloud::accessKeyClient('my-access-key-id', 'my-access-key-secret')
            ->regionId('cn-shanghai')
            ->asDefaultClient();

        $response = ImageSearch::v20190325()->addImage()
            ->withInstanceName($instanceName)
            ->withPicName("testimage1")
            ->withPicContent(base64_encode($content))
            ->withProductId('imageproductid1')
            ->debug(true)
            ->request();

        dump($response);

debug信息:

*   Trying 139.196.67.150:80...
* TCP_NODELAY set
* Connected to imagesearch.cn-shanghai.aliyuncs.com (139.196.67.150) port 80 (#0)
> POST /v2/image/add?Version=2019-03-25 HTTP/1.1
Host: imagesearch.cn-shanghai.aliyuncs.com
User-Agent: AlibabaCloud (Darwin 19.2.0; x86_64) Client/1.5.20 PHP/7.2.26 SDK/1.8.49
x-acs-version: 2019-03-25
x-acs-region-id: cn-shanghai
Date: Wed, 08 Jan 2020 07:46:33 GMT
x-acs-signature-method: HMAC-SHA1
x-acs-signature-nonce: c845ccab5c5faa0b9eaddd69d1acb20f
x-acs-signature-version: 1.0
Accept: application/json
Content-Type: application/json; charset=utf-8
Content-MD5: iaWaKljvUjaHN8cW9MGHaA==
Authorization: acs LTAImWU5L09SaUHd:qUQfKKT4VUS2kQadvQ3uVo7F0x4=
Content-Length: 127237

* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Date: Wed, 08 Jan 2020 07:46:35 GMT
< Content-Type: application/json; charset=UTF-8
< Content-Length: 285
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS
< Access-Control-Allow-Headers: X-Requested-With, X-Sequence, _aop_secret, _aop_signature
< Access-Control-Max-Age: 172800
< x-acs-request-id: B65D5B4A-5D6E-4FA0-A794-C37F91391A88
< Server: Jetty(7.2.2.v20101205)
<

mnsClient BatchReceiveMessage 参数bug

  • PHP Version:7.2
  • Platform:mac
  • Product:mns
  • Product Version:1.2.4
  • API: BatchReceiveMessage

hi
sdk中提供的mnsClient存在参数问题 导致无法正常获取mns队列消息

我方在升级使用新版php-sdk, 出现无法拉取mns消息bug
阿里云官方工单反馈如下
工程师 60810 号 : 您好,已经为您核实,您的这个sdk不是消息服务mns官方提供的sdk,传的参数WaitSeconds 这个是非标准的,标准的应该是:waitseconds,还要请您知晓哈,官方提供的mns的sdk,您可以参考下
https://help.aliyun.com/document_detail/32381.html?spm=a2c4g.11186623.6.655.2b947f87MOpJpF
您使用这个sdk测试下,看是否还有500的情况呢?

经查证问题出自
AlibabaCloud\Dybaseapi\MNS\Requests\BatchReceiveMessage;
line:86 88 两个参数错误

请核实.

composer require alibabacloud/sdk 会删除文件 请谨慎使用

  • PHP Version:PHP 7.2
  • Platform: Mac OS 10.14.6 X64
  • Product:
  • Product Version:
  • API: composer require alibabacloud/sdk

tp5.05 项目根目录中
运行: composer require alibabacloud/sdk 安装成功,
结果:thinkphp目录中的 start.php 被无缘无故删除。导致项目不能运行。
测试次数:3次,
测试结果:文件均被删除

请问阿里云 afs的包怎么用?

我看就两个文件,然后和官方demo完全不一致在,这个怎么用啊?

顺带今天下午官方demo都是 ic error,这个怎么解决?

文档要求php版本>5.6,但实际composer安装后,需要php>7.2

文档要求php版本>5.6,但实际composer安装后,需要php>7.2
其中依赖的组件明确要求php版本>7.2,可能是组件pcr,因此建议:
1、明确组件版本,尽量降低组件对新版的要求;
2、精确本产品安装后的实际版本需求。

  • PHP Version:php.5.6.38
  • Platform:macos
  • Product: alibabacloud/sdk(sts)
  • Product Version:最新版本
  • API:

MissingProject: Project is mandatory for this action.

 AlibabaCloud::accessKeyClient(config('oss.access_key_id'), config('oss.access_key_secret'))
                    ->regionId('cn-beijing')
                    ->asDefaultClient();

                $request = AlibabaCloud::imm()->v20170906()->createOfficeConversionTask([
                    'Project' => 'test',
                    'SrcUri'  => 'oss://xxx-p1-dev/26484f3a6d4d70b4e983a16e1575ef4d83382967.pdf',
                    'TgtType' => 'jpg',
                    'TgtUri'  => 'oss://xxx-p1-dev/26484f3a6d4d70b4e983a16e1575ef4d83382967.pdf/output',
                ]);

                $result = $request->request();

                dump($result);

传递了 Project 还是提示 MissingProject,需要什么姿势去使用呢?谢谢。

新版sdk不兼容5.6版本吗?

  • PHP Version:5.6
  • Platform:SDK
  • Product:dysmsapi
  • Product Version:2017-05-25
  • API:SendSms

sdk会调用random_int和random_b*** 的php7内置函数导致发送失败!

    AlibabaCloud::accessKeyClient($config['sms_appkey'], $config['sms_secretKey'])
        ->regionId('cn-hangzhou') // replace regionId as you need
        ->asDefaultClient();
    try {
        $result = AlibabaCloud::rpc()
            ->product('Dysmsapi')
            // ->scheme('https') // https | http
            ->version('2017-05-25')
            ->action('SendSms')
            ->method('POST')
            ->options([
                'query' => [
                    'RegionId'=>'cn-hangzhou',
                    'PhoneNumbers' => $mobile,
                    'SignName' => $config['sms_product'],
                    'TemplateCode' => $config['sms_templateCode'],
                    'TemplateParam' => json_encode(['code'=>$code]),
                ],
            ])
            ->request();
        $resp = $result->toArray();
.....

Need SDK for Message Notification queue service(MNS).

I created queue under Message Notification Service using the console and Now I want to receive message/instruction using PHP SDK, but I didn't find any support for the Message notification service queue(MNS).

Is there SDK available for MNS service? If Yes can you share with me that details Else is there any plan to release?

Thank you in advance.

请问能否进行分包

不分包有太多坑,加载一个组件时,结果需要拉取左右组件,发布线上要发布好几千个文件,composer静态加载文件特别大

vod 获取视频信息出错

这是我能想到的参数的, 你们的文档实在是太少.

// Set up a global client
        AlibabaCloud::accessKeyClient(config('oss.access_key'), config('oss.secret_key'))
            ->regionId(config('oss.original_bucket_region')) // oss-cn-beijing or cn-beijing ?
            ->asDefaultClient();


        $response = Vod::v20170321()
            ->getVideoInfos(['videos/54c097dd-3060-4052-9729-80aceca2ef06.mp4'])
            ->debug(true)
            ->request();
  
// response output
* Connection #0 to host vod.oss-cn-beijing.aliyuncs.com left intact

   AlibabaCloud\Client\Exception\ServerException  : SDK.UnknownError: <?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AccessDenied</Code>
  <Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
  <RequestId>5F053847B258223133F1711A</RequestId>
  <HostId>vod.oss-cn-beijing.aliyuncs.com</HostId>
  <Bucket>vod</Bucket>
  <Endpoint>oss-cn-shanghai.aliyuncs.com</Endpoint>
</Error>
 RequestId:  POST "http://vod.oss-cn-beijing.aliyuncs.com" 403

看这个应该是 endpoint 错误了, 但没看到有参数可以设置. 烦请帮忙看一下, 谢谢.

文档要求php版本>5.6,但实际composer安装后,需要php>7.2

文档要求php版本>5.6,但实际composer安装后,需要php>7.2
其中依赖的组件明确要求php版本>7.2,可能是组件pcr,因此建议:
1、明确组件版本,尽量降低组件对新版的要求;
2、精确本产品安装后的实际版本需求。

PHP Version:php.7.0.33
Platform:macos
Product: alibabacloud/sdk(sts)
Product Version:^1.8

composer 安装报错提示如下:
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

Problem 1
- guzzlehttp/guzzle is locked to version 7.2.0 and an update of this package was not requested.
- guzzlehttp/guzzle 7.2.0 requires php ^7.2.5 || ^8.0 -> your php version (7.0.33) does not satisfy that requirement.
Problem 2
- symfony/polyfill-mbstring is locked to version v1.20.0 and an update of this package was not requested.
- symfony/polyfill-mbstring v1.20.0 requires php >=7.1 -> your php version (7.0.33) does not satisfy that requirement.
Problem 3
- guzzlehttp/guzzle 7.2.0 requires php ^7.2.5 || ^8.0 -> your php version (7.0.33) does not satisfy that requirement.
- alibabacloud/client 1.5.29 requires guzzlehttp/guzzle ^6.3|^7.0 -> satisfiable by guzzlehttp/guzzle[7.2.0].
- alibabacloud/client is locked to version 1.5.29 and an update of this package was not requested.

STS获取accessToken出师不利

提示:May not yet support product Sts quick access, you can use [Alibaba Cloud Client for PHP] to send any custom requests: https://github.com/aliyun/openapi-sdk-php-client/blob/master/docs/en-US/3-Request.md

大佬们求救,第一次用阿里云的这种SDK方式。有点懵。如下图所示,提示错误如上图。

我现在是想WEB上传文件到OSS,目前看文档说是要通过AK的方式来获取令牌环,然后用令牌环来上传文件,就是这个accessToken,卡这一步了。不知道逻辑上对不对,求救。

php7.3.* php7.4.* 签名失败

Action: SingleSendMail (其他方法没测)

实测:
php 7.3.11,php7.4.8
返回签名失败

#errorCode: "SignatureDoesNotMatch"
#errorMessage: "Specified signature is not matched with our calculation.

动态Client支持

您的功能请求是否与问题有关? 请描述一下。
我们是基于Swoole做的项目。在项目中会存在会根据请求去使用不同的accesskey和accesssecret。由于是协程并发。所以会导致static会存在不安全。所以有计划去支持动态client么。还是说只能根据协程ID 去区分不同的clientname 去保证安全

描述你想要的解决方案
请描述所需的行为。

描述您考虑过的替代方案
请描述您考虑的替代解决方案或功能。

vod中ListVodTemplate的TemplateType参数有哪些选项?

ListVodTemplate这个接口在新版的aliyun-php-sdk-vod/vod中是ListTranscodeTemplateGroupRequest负责的(我只是从单词意思上分析的),官方文档里也没有ListVodTemplate的介绍,现在都是composer直接安装的,为啥两边不保持一致呢?

请勿能否支持分包

不分包有太多坑,加载一个组件时,结果需要拉取左右组件,发布线上要发布好几千个文件,composer静态加载文件特别大

车牌识别需要include什么文件呢?也没有autoload

use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;

这个你告诉我你的openapi-sdk-php-master里 是什么文件?没头没脑的sdk,看得人恼火不已

Dm Versions contains no V20151123

报错 Dm Versions contains no V20151123

版本 1.2.10

$request = AlibabaCloud::dm()->v20151123()->singleSendMail()
            //管理控制台中配置的发信地址。
            ->withAccountName($from_mail)
            //发信人昵称,长度小于 15 个字符。 例如:发信人昵称设置为”小红”,发信地址为 “[email protected]”,收信人看到的发信地址为"小红"<[email protected]>
            ->withFromAlias($from_alias)
            //取值范围 0~1: 0 为随机账号;1 为发信地址。
            ->withAddressType($is_random_address ? 0 : 1)
            //使用管理控制台中配置的回信地址(状态必须是验证通过)。
            ->withReplyToAddress('true')
            // 目标地址,多个 email 地址可以用逗号分隔,最多100个地址。
            ->withToAddress($email)
            // 收件标题
            ->withSubject($subject)
            // 收件正文
            ->withHtmlBody($content);

Request parameters has malformed encoded characters.

调用机器翻译API,使用PHP SDK存在中文的时候提示请求参数编码有问题,这个需要如何处理? 英文翻译到中文没有问题,但是中文翻译到英文报错提示:Request parameters has malformed encoded characters. 尝试UTF-8处理没有用。

header("Content-Type: text/html;charset=utf-8");

require DIR . '/vendor/autoload.php';
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;

// Download:https://github.com/aliyun/openapi-sdk-php
// Usage:https://github.com/aliyun/openapi-sdk-php/blob/master/README.md

AlibabaCloud::accessKeyClient('*******', '***********')
->regionId('cn-hangzhou')
->asDefaultClient();

try {
$result = AlibabaCloud::rpc()
->product('alimt')
// ->scheme('https') // https | http
->version('2018-10-12')
->action('TranslateGeneral')
->method('POST')
->host('mt.cn-hangzhou.aliyuncs.com')
// ->addHeader("charset", "UTF-8")
// ->addHeader("content-type", "application/x-www-form-urlencoded")
->options([
'query' => [
'RegionId' => "cn-hangzhou",
'FormatType' => "text",
'SourceLanguage' => "zh",
'TargetLanguage' => "en",
'SourceText' => "北京欢迎你",
// 'SourceText' => utf8_encode("北京欢迎你"),
'Scene' => "general",
],
])
->request();
print_r($result->toArray());
} catch (ClientException $e) {
echo $e->getErrorMessage() . PHP_EOL;
} catch (ServerException $e) {
echo $e->getErrorMessage() . PHP_EOL;
}
`

`

What's the diference between `retryByClient()` and `retryByServer()`?

According to vendor/alibabacloud/client/src/Request/Request.php, a "Server Retry" is calling request() again, and a "Client Retry" is calling response() again. But request() is just resolveOption() + response(). Also, both shouldServerRetry() and shouldClientRetry() determines the status code returned from GuzzleHttp. It seems that they behave the same. So which should I use for ensuring the idempotent (https://help.aliyun.com/document_detail/25693.html)?

Image search empty codes

I am currently testing Image search from this repo, but unfortunately, I am sending an empty request as per stated by the Support Engineer when doing tickets in the console. I am writing here as it was suggested by the Support engineer to raise an issue here instead.

My question is that, why is the Image search codes are empty compare to the Aliyun open api sdk or the downloadable library

Any way you can update the image search? As I really prefer to use composer when installing libraries.

If you have a question about Alibaba Cloud that is not a bug report or feature
request, please post it in https://selfservice.console.aliyun.com/ticket/createIndex

Questions posted to this repository will be closed.

OSS 什么时候引入进来?

您的功能请求是否与问题有关? 请描述一下。
请描述您要解决的问题。
OSS 似乎一直独立于 SDK 之外。什么时候可以集成进来?

描述你想要的解决方案
请描述所需的行为。
集成 OSS

描述您考虑过的替代方案
请描述您考虑的替代解决方案或功能。

容器镜像服务Cr 配置问题

  • PHP 版本:7.2.6
  • 平台:docker alpine
  • 产品名称:容器镜像服务Cr
  • 产品版本:20160607
  • API:getRepoList

代码基本是拿官网文档过来后做的修改:

AlibabaCloud::accessKeyClient('xxx','xxx')->regionId('cn-hangzhou')->asDefaultClient();

try {
	$options = [
	    'debug' => true,
	    'query' => [
	        'Status' => 'NORMAL',
	        'RepoNamePrefix' => ''
	    ]
	];
	$request = Cr::v20160607()
	            ->getRepoList($options);

	$r = $request->request();
} catch (ServerException $e) {
    echo $e->getResult();
}

最后捕获打出来的结果是:

{"RequestId":"806D70E8-32B0-4F18-8C8A-CA54E5D22E2E","HostId":"location.aliyuncs.com","Code":"Illegal Parameter","Message":"Please check the parameters"}

不清楚是哪里参数有误。
而且API文档https://help.aliyun.com/document_detail/72399.html 上还有个RepoNamePrefix参数,要求是必须提供该参数,但SDK中又没有AlibabaCloud\Cr\V20160607\GetRepoList::withRepoNamePrefix()这样的函数,所以我通过options['query']进行了传递,不知道是否正确。

accessKeyId和accessKeySecret都是正确的
到底哪里出现了参数错误?

为了偷懒,我copy了别人提交的一样反馈记录.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.