JavaScript
x
header("location:http;//")
Above line does not seem to work when executing PHP scripts from command line. How best can I open links via command line?
Advertisement
Answer
A very hastily and quickly tested method might be to use exec
passing in the path to a known browser with the url as it’s argument – seemed to work ok.
JavaScript
<?php
$url='https://www.google.co.uk';
$cmd=sprintf( '%%userprofile%%AppDataLocalGoogleChromeApplicationchrome.exe %s', $url );
exec( $cmd );
?>
Thanks to @Álvaro’s comment the above can be simplified further( on Windows at least )
JavaScript
<?php
$url='https://www.google.co.uk';
$cmd=sprintf( 'start %s',$url );
exec( $cmd );
?>