【发布时间】:2019-04-14 09:13:16
【问题描述】:
我正在尝试解析来自this page 的链接。
我使用这个代码:
$link = 'https://ws-na.assoc-amazon.com/widgets/cm?t=websitcom05-20&o=1&p=26&l=ur1&category=primeent&banner=1XSEYPQA2R6RS2D2B802&f=ifr';
$pageContent = file_get_contents($link);
$html = str_get_html($pageContent);
$body = $html->find('body', 0, true);
foreach ($body->find('area') as $area)
{
echo $area->href;
}
输出为http://rcm-na.amazon-adsystem.com/e/cm/privacy-policy.html?o=1 https://www.amazon.com
第二个链接被截断。 请帮助我从页面获取完整链接。
我需要这个输出:https://www.amazon.com/gp/video/offers/ref=dvm_us_dd_as_evgrn?ie=UTF8&linkCode=ur1&redirectToAsin=B01EN8ZQKS&tag=INSERTSTOREID&tag=websitcom05-20
【问题讨论】:
标签: php html dom href file-get-contents