For a single simple command such as ping , one can use xargs. The cool thing about xargs is that it has --arg-file option which allows you to specify file which xargs will use to provide positional parameters to the command you're trying to run; in your case, that would be one site per line in the text file.
Specifically the command you want is this:
xargs -I% --arg-file=./input.txt ping -c 4 %
-I allows us to choose place holder for each argument, which xargs internally will
--arg-file is the file from which positional parameters will come from; note that we're using ./ to indicate that the file is located in current working directory
ping -c 4 will attempt to ping each site that comes from input.txt with 4 packets
Note that we can also use -q option to ping that will prevent printing a line for each packet received/transmitted, with only statistics being outputted. From there we can clean up output even further with awk or any other text-processing utility (keep in mind that output will be buffered while going via pipe and waiting for ping to actually finish and output statistics, so will show up on the screen a bit slow):
$ xargs -I% --arg-file=./input.txt ping -c 4 % -q | awk '/^---/||/avg/'
--- askubuntu.com ping statistics ---
rtt min/avg/max/mdev = 49.677/73.403/94.312/19.276 ms
--- unix.stackexchange.com ping statistics ---
rtt min/avg/max/mdev = 40.015/59.099/115.545/32.590 ms
--- stackoverflow.com ping statistics ---
rtt min/avg/max/mdev = 40.130/40.878/42.685/1.056 ms
$ xargs -I% --arg-file=./input.txt ping -c 4 % -q | awk -F'[ /]' '/^---/{print $2};/avg/{print $8}'
askubuntu.com
39.809
unix.stackexchange.com
189.557
stackoverflow.com
161.974