Merge pull request #462 from shikorism/fix/454-ogpresolver-cookie
OGPResolver: リダイレクト時にCookieを維持させる
This commit is contained in:
commit
8093b22981
@ -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