Guzzle6 error Invalid resource type: array when send a GuzzleHttp\Psr7\Request

前端 未结 1 1853
心在旅途
心在旅途 2021-01-22 01:34

I am trying to send a code by using GuzzleHttp\\Psr7\\Request,somehow I get error Invalid resource type: array, the following is my codes

$params = [\"name\"=&g         


        
相关标签:
1条回答
  • 2021-01-22 01:47

    If you want to use JSON in the request, just create it with json_encode():

    $request = new Request(
        'PUT',
        'https://api.hitbox.tv/media/live/myName?authToken=myToken',
        ["content-type" => 'application/json'],
        json_encode($params)
    );
    
    0 讨论(0)
提交回复
热议问题