如何在 Shopware 中使用 restClient 使用令牌调用 URL?

问题描述

我正在尝试调用外部网址。我的网址看起来像这样。

curl -X GET "https://api.manu.th/v1/list" -H "accept: application/json" -H "Token: token_number" 

现在我无法使用 Shopware 6 来实现它。到目前为止,我已经尝试了以下代码行。

$this->restClient = new Client();
$request = new Request(
            'GET',"https://api.manu.th/v1/list",[
                'Token' => 'token_number'
            ],['Content-Type' => 'application/json']
        );

        $response = $this->restClient->send($request);

        $body = json_decode($response->getBody()->getContents(),true);

这让我返回is not callable: Invalid resource type: array","Meta": {

有人可以帮我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)