次のコードを使用して、別のページから html を取得し、php ページに配置しています。
$doc = new DomDocument;
// We need to validate our document before refering to the id
$doc->validateOnParse = true;
$doc->loadHtml(file_get_contents('{URL IS HERE}'));
$content = $doc->getElementById('form2');
echo $doc->SaveHTML($content);
<a href="/somepath/file.htm">
代わりに実際のドメインを先頭に追加できるように、のすべてのインスタンスを変更したいと考えています。これどうやってするの?
したがって、代わりにそれらを次のように変更する必要があります <a href="http://mydomain.com/somepath/file.htm">
。