Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a URL using PHP?

I want something similar like JavSacript's window.open() method, which I can use to open a particular URL, for example, https://www.google.com/.

Is there a way in pure PHP where I can do the same thing?

I know we can do that using selenium in python. I think guzzle might be of some help but I can not find anything useful on the web on that. Thanks in advance.

like image 836
Soumi Basu Avatar asked Dec 06 '22 20:12

Soumi Basu


1 Answers

Although you can not open a new window through PHP directly, you can use:

header("Location: <LOCATION_TO_REDIRECT>");

To redirect the current browser window to the specified URL.

like image 65
Vivek Srivastava Avatar answered Dec 09 '22 15:12

Vivek Srivastava