Reputation: 69
In one of scripts I use daily I have something like this:
<?php
$args = explode("\n", $argv[1]);
// loop through args
foreach ($args as $arg) {
// create the url
$url = 'https://trends.google.pl/trends/explore?date=now%207-d&geo=PL&q=,' . urlencode(trim($arg));
// open the url in the default browser
shell_exec('open ' . escapeshellarg($url));
}
?>
How to change this part
// open the url in the default browser
shell_exec('open ' . escapeshellarg($url));
to open the URL in chrome browser? Because for now it opens it in default browser and I don't want to change the default browser to chrome in my os (macos)
Upvotes: 1
Views: 762
Reputation: 1745
You can use -a flags and the application name
shell_exec('open -a "Google Chrome" '.escapeshellarg($url));
Upvotes: 2