shell_exec("traceroute IPaddress) returns traceroute to IPaddress (IPaddress), 30 hops max, 40 byte packets
How do I retrieve the actual list of hops so I can tell where a problem occurs?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Those messages are supposed to be written to
stderrinstead of the regularstdout, so I’m not too sure why you’re seeing them appear in the output.Instead of
shell_exec()I would recommend usingexec()because it captures both the output AND the return code of the process:To speed up the command a little you could use the
-noption when you runtracerouteto avoid having to do DNS lookups for the intermediate hops.Note that running
traceroutecan take a while; if you run it on the command line you can sometimes see lines with* * *in them, which can take ages!