<?php
declare(strict_types=1);
require_once('vendor/autoload.php');
use Embed\Embed;
use Symfony\Component\VarDumper\VarDumper;
$ef = new Embed();
$site = 'http://10.110.37.5:8888';
$image = '/hug.jpeg';
$direct = $ef->get($site.$image);
$r301 = $ef->get($site.'/301'.$image);
$r302 = $ef->get($site.'/302'.$image);
dump([
'direct' => [
'fetch' => (string) $direct->getRequest()->getUri(),
'exist' => (bool) $direct,
'url' => (string) $direct->url,
'code' => $direct->code
],
'301' => [
'fetch' => (string) $r301->getRequest()->getUri(),
'exist' => (bool) $r301,
'url' => (string) $r301->url,
'code' => $r301->code
],
'302' => [
'fetch' => (string) $r302->getRequest()->getUri(),
'exist' => (bool) $r302,
'url' => (string) $r302->url,
'code' => $r302->code
],
]);
when fetching an image link that's behind redirect, the extracted embed info contains no usable info or html for embedding.
the crawler seems to be following redirects fine, but the extracted data wan't updated to reflect the new contents at the redirected location.
not sure if this also apply to other embed resource links.
rough setup/test script