OGPResolver: リダイレクト時にCookieを維持させる
This commit is contained in:
parent
e6950a5dfb
commit
7aa11275cc
@ -3,6 +3,8 @@
|
|||||||
namespace App\MetadataResolver;
|
namespace App\MetadataResolver;
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
use GuzzleHttp\Cookie\CookieJar;
|
||||||
|
use GuzzleHttp\RequestOptions;
|
||||||
|
|
||||||
class OGPResolver implements Resolver, Parser
|
class OGPResolver implements Resolver, Parser
|
||||||
{
|
{
|
||||||
@ -18,7 +20,7 @@ class OGPResolver implements Resolver, Parser
|
|||||||
|
|
||||||
public function resolve(string $url): Metadata
|
public function resolve(string $url): Metadata
|
||||||
{
|
{
|
||||||
return $this->parse($this->client->get($url)->getBody());
|
return $this->parse($this->client->get($url, [RequestOptions::COOKIES => new CookieJar()])->getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parse(string $html): Metadata
|
public function parse(string $html): Metadata
|
||||||
|
Loading…
Reference in New Issue
Block a user