symfony4 - 如何在 Shopware 中使用 restClient 调用带有令牌的 URL?
问题描述
我正在尝试调用外部 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": {
有人可以帮我吗?
解决方案
推荐阅读
- apache-zookeeper - 无法外部连接zookeeper节点
- sql - 尝试执行更新过程但出现错误 - PL/SQL: ORA-00933:
- c# - 在 asp.net/c# 中将电子邮件服务器连接到我的 Web 应用程序的联系人页面#
- outlook - Outlook 2013 为转发的电子邮件生成无效的附件 ID,导致 EWS GetAttachment() 操作失败
- javascript - 在使用 React JS 时,为什么 setState 无法更新按钮单击时的图表值?
- css - 在浏览器开发者工具中检查/切换 CSS 伪类
- jquery - 道具检查不起作用 - 特殊情况
- sapui5 - 寻找缺失的对话价值^^
- java - 密码输出流不起作用
- python - Pandas - 如果列包含列表中的任何值,而不是全部,则使用 isin 返回