Wordpress PHP-将图像下载到媒体库并获取thumbnail_id

时间:2019-04-18 18:44:40

标签: php wordpress guzzlehttp domcrawler

我如何将图像下载到我的wordpress媒体库中并获得thumbnail_id,我已经尝试了以下代码

$res = $client->request('GET', $url);

$html = ''.$res->getBody();

$crawler = new Crawler($html);

$manga_cover = $crawler->filter('.cover')->filter('img')->attr('src');

$cover_url = 'https://'.$manga_cover;

// image url
print_r($cover_url);

0 个答案:

没有答案