如何在Guzzle中获得身材?

时间:2019-09-18 18:41:04

标签: php guzzle guzzle6

我使用此请求:

  $client = new \GuzzleHttp\Client();
        $options = [
            'form_params' => [
                "tip" => "P",
                "voen" => "V",
                "voen" => $voen,
                "submit" => "Yoxla",
            ],
        ];
        $res = $client->request('POST', 'https://www.ebyn/payerOrVoenChecker.jsp', $options);

        dd($res->getBody());

结果我得到了:

Stream {#340 ▼
  -stream: stream resource @424 ▼
    wrapper_type: "PHP"
    stream_type: "TEMP"
    mode: "w+b"
    unread_bytes: 0
    seekable: true
    uri: "php://temp"
    options: []
  }
  -size: null
  -seekable: true
  -readable: true
  -writable: true
  -uri: "php://temp"
  -customMetadata: []
}

那么,如何获得实体,它是HTML页面?

1 个答案:

答案 0 :(得分:1)

您的解决方案:

$res->getBody()->getContents();

详细了解this answer