http://board.phpbuilder.com/showthread.php?10369260-PHP-echo-to-open-new-window

<?php 
echo '<script type="text/javascript" language="javascript"> 
window.open("http://www.something.com"); 
</script>'; 
?>

Pass Variables and get them in next script:

JS method:
window.open("http://mysite.com/myfile.php?var1=foo&var2=bar");
myfile.php
<?php
    $var1 = $_GET['var1'];
    $var2 = $_GET['var2'];
    ...
?>

Pass back file via readfile as per normal

Pass PHP Variable inside javascript:

http://stackoverflow.com/questions/42498574/php-pass-variable-to-new-window-open-javascript/42498945#42498945

 $link = "http://newpage.com$file";

  echo "<script type='text/javascript' language='javascript'>
  window.open('$link');
  </script>";