Simple HTML DOM Parser でスクレイピング した img要素 の src のパスを絶対URLに変更する方法です。
取得元がimgを相対パスで指定しているときに使用しました。
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?php           require_once 'lib/simple_html_dom.php';           $url_inc = https://sample.com/sample.html';           $html = file_get_html($url_inc);           foreach($html ->find('img') as $item) {                 $value = $item->src;                 //img要素の src にURLを付けて絶対URLに変更                $item->src = 'https://sample.com/'.$value;               }           $html->save();            $element = $html->find('div[id=sample]', 0);            echo $element;  ?>  | 

 
	 
		 
		 
			 
			