guzzlehttp-“缺少输入的秘密和缺少的输入响应”

问题描述 投票:0回答:1

所以我正在使用GruzzleHttp 6.5.0 w / Laravel 6.7.0。

[通过Guzzle验证Google reCaptcha时,似乎请求正文/'form_params'未包含在POST参数中

这里是PHPUnit 8.5.0输出

object(GuzzleHttp\Psr7\Request)#1179 (7) {
 ["method":"GuzzleHttp\Psr7\Request":private]=>
  string(4) "POST"
  ["requestTarget":"GuzzleHttp\Psr7\Request":private]=>
  NULL
  ["uri":"GuzzleHttp\Psr7\Request":private]=>
  object(GuzzleHttp\Psr7\Uri)#1180 (7) {
    ["scheme":"GuzzleHttp\Psr7\Uri":private]=>
    string(5) "https"
    ["userInfo":"GuzzleHttp\Psr7\Uri":private]=>
    string(0) ""
    ["host":"GuzzleHttp\Psr7\Uri":private]=>
    string(14) "www.google.com"
    ["port":"GuzzleHttp\Psr7\Uri":private]=>
    NULL
    ["path":"GuzzleHttp\Psr7\Uri":private]=>
    string(25) "/recaptcha/api/siteverify"
    ["query":"GuzzleHttp\Psr7\Uri":private]=>
    string(0) ""
    ["fragment":"GuzzleHttp\Psr7\Uri":private]=>
    string(0) ""
  }
  ["headers":"GuzzleHttp\Psr7\Request":private]=>
  array(3) {
    ["Host"]=>
    array(1) {
      [0]=>
      string(14) "www.google.com"
    }
    ["headers"]=>
    array(1) {
      ["Content-Type"]=>
      string(33) "application/x-www-form-urlencoded"
    }
    ["form_params"]=>
    array(2) {
      ["secret"]=>
      string(40) "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe"
      ["response"]=>
      string(3) "123"
    }
  }
  ["headerNames":"GuzzleHttp\Psr7\Request":private]=>
  array(3) {
    ["headers"]=>
    string(7) "headers"
    ["form_params"]=>
    string(11) "form_params"
    ["host"]=>
    string(4) "Host"
  }
  ["protocol":"GuzzleHttp\Psr7\Request":private]=>
  string(3) "1.1"
  ["stream":"GuzzleHttp\Psr7\Request":private]=>
  object(GuzzleHttp\Psr7\Stream)#1182 (7) {
    ["stream":"GuzzleHttp\Psr7\Stream":private]=>
    resource(609) of type (stream)
    ["size":"GuzzleHttp\Psr7\Stream":private]=>
    int(0)
    ["seekable":"GuzzleHttp\Psr7\Stream":private]=>
    bool(true)
    ["readable":"GuzzleHttp\Psr7\Stream":private]=>
    bool(true)
    ["writable":"GuzzleHttp\Psr7\Stream":private]=>
    bool(true)
    ["uri":"GuzzleHttp\Psr7\Stream":private]=>
    string(10) "php://temp"
    ["customMetadata":"GuzzleHttp\Psr7\Stream":private]=>
    array(0) {
   }
 }

''''Content-Type'''标头是手动设置的。

在Laravel中,我可以访问密码和URL,所以这不是问题。特别是因为请求已发送到正确的URL。

您的帮助将不胜感激:)

问候

php curl guzzle laravel-6
1个回答
0
投票

小加-JSON解码为具有TRUE选项的数组后的响应转储:

PHPUnit 8.5.0 by Sebastian Bergmann and contributors.

...Array
(
    [success] =>
    [error-codes] => Array
        (
            [0] => missing-input-response
            [1] => missing-input-secret
        )

)
F                                                                4 / 4 (100%)

Time: 2.46 seconds, Memory: 18.00 MB
© www.soinside.com 2019 - 2024. All rights reserved.