-2

I want to create a shell file to run a URL without opening the browser, it could have been run in Windows but in Linux does anyone know how to do it?

Grover
  • 1
  • 1
  • 1
  • Have a look at [curl](https://curl.haxx.se/docs/) or [wget](https://www.gnu.org/software/wget/manual/wget.html) utilities available on Linux. – vpa2 May 04 '18 at 15:06
  • Possible duplicate of [How to get the contents of a webpage in a shell variable?](https://stackoverflow.com/questions/3742983/how-to-get-the-contents-of-a-webpage-in-a-shell-variable) – Robin Green May 04 '18 at 21:00

2 Answers2

0

You can make an HTTP request from the command line using wget, or curl, or lynx, or perl (with the WWW::UserAgent module), or nodejs (with the fetch or request modules), or php (with the file_get_contents function), or a host of other approaches.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

This has been done in windows in a bat file so that the execution of the URL is programmed every 7 minutes now I would like to migrate it to linux as I migrate the method with its user and pass parameters.

    @if (@CodeSection == @Batch) @then
@echo off & setlocal
set "URL=http://......."
cscript /nologo /e:jscript "%~f0" "%URL%"
goto :EOF
@end // end batch / begin JScript chimera

var x = WSH.CreateObject("Microsoft.XMLHTTP");

x.open("GET",WSH.Arguments(0),false,"user","pass");
x.setRequestHeader('User-Agent','XMLHTTP/1.0');
x.send('');
while (x.readyState != 4) WSH.Sleep(50);
Grover
  • 1
  • 1
  • 1