Is there a character and character in your url? If so, your wget can go in the background, and shell_exec () can return immediately.
For example, if $ url is "http://www.example.com/?foo=1&bar=2", you need to make sure that it is sent in one quote when passing on the command line:
shell_exec("wget '$url'");
Otherwise, the shell misinterprets &.
Escaping command line options is a good idea overall. The most complete way to do this is escapeshellarg ():
shell_exec("wget ".escapeshellarg($url));
source share