I am trying to figure something out, i am getting the html source code of remote page and this code contain links like this one below:
<a href='javascript:openWindow("index1.php?option=com_lsh&view=lsh&event_id=156029&tv_id=848&tid=34928&channel=0&tmpl=component&layout=popup&Itemid=335","735","820")' >Link#1</a>
I want to edit such link before echo it to on my page to make it open in new tab not in new window.
i getting the remote page source with file get content as below:
<?php
//Get the url
$url = "http://remote.com/static/section0.html";
$html = file_get_contents($url);
$doc = new DOMDocument(); // create DOMDocument
libxml_use_internal_errors(true);
$doc->loadHTML($html); // load HTML you can add $html
$elements = $doc->getElementsByTagName('tbody');
$toRemove = array();
// gather a list of tbodys to remove
foreach($elements as $el)
if((strpos($el->nodeValue, 'desktop') !== false) && !in_array($el->parentNode, $toRemove, true))
$toRemove[] = $el->parentNode;
foreach($elements as $el)
if((strpos($el->nodeValue, 'Recommended') !== false) && !in_array($el->parentNode, $toRemove, true))
$toRemove[] = $el->parentNode;
// remove them
foreach($toRemove as $tbody)
$tbody->parentNode->removeChild($tbody);
echo str_replace('</h3><table','<table',$doc->saveHTML());
?>
as you see i also doing some other editation on the code but i cant transform open new window to new tab
any ideas?