Connecting Tech Pros Worldwide Help | Site Map

how to measure the ping time between the visitor and my website ??

Alexandre Plennevaux
Guest
 
Posts: n/a
#1: Jul 17 '05
hello !

I would like to measure the time a user needs to connect to my website.
In other words, to perform a ping between my website and the user's
computer.

I'm scratching my head as to how i can do that. Does anyone know a good way
to make this happen?

thanks a lot,

alexandre


CountScubula
Guest
 
Posts: n/a
#2: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


"Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
news:3ff21d41$0$20551$ba620e4c@news.skynet.be...[color=blue]
> hello !
>
> I would like to measure the time a user needs to connect to my website.
> In other words, to perform a ping between my website and the user's
> computer.
>
> I'm scratching my head as to how i can do that. Does anyone know a good[/color]
way[color=blue]
> to make this happen?
>
> thanks a lot,
>
> alexandre
>[/color]

Here you go
<?
$ip = $_SERVER['REMOTE_ADDR'];
$res = `ping -c 1 $ip`;

list($n,$r) = explode("packet loss, ",$res);
list($pTime,$n) = explode("ms",$r);
print "Ping time $pTime ms";
?>

you can test it here:
http://gzen.myhq.info/test/ping.php


Ok, now several things wrong with this, first, this will only work if ping
packets are allowed through the entire netork from you to them, inside thier
network if they are in say a corporate building. Now if they are behind a
firewall, you will only get times to the firewall. (depends on firewall, but
most likely, firewall times)

Now, this also assumes they dont have any type of stupid software like
black-ice, (sorry to offend, but if you have a software firewall installed
on the machine you are trying to protect, your an idiot, get a solution
before the machine you are protect!) -- ok sorry about that

Also, the route that someone uses to send packets to you is not nessasarily
the route the packets take from you to them. For example. At one of my data
centers, outgoing data is routed through the least congested pipe.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
[color=blue]
>[/color]


Alexandre Plennevaux
Guest
 
Posts: n/a
#3: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


thanks a lot mike.

I'm gettting 0 ms all the time. Is that normal ?
Also, would this work on a virtual server? I heard Virtual servers don't
let you execute commands with php, as you could use it to execute "rm -rf /"
or other bad things. So, they set this in their php.ini.
What do you think ?

thanks again,

alexandre
PS: nice website :)

"CountScubula" <me@scantek.hotmail.com> wrote in message
news:jKpIb.3882$pN.2576@newssvr29.news.prodigy.com ...[color=blue]
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff21d41$0$20551$ba620e4c@news.skynet.be...[color=green]
> > hello !
> >
> > I would like to measure the time a user needs to connect to my website.
> > In other words, to perform a ping between my website and the user's
> > computer.
> >
> > I'm scratching my head as to how i can do that. Does anyone know a good[/color]
> way[color=green]
> > to make this happen?
> >
> > thanks a lot,
> >
> > alexandre
> >[/color]
>
> Here you go
> <?
> $ip = $_SERVER['REMOTE_ADDR'];
> $res = `ping -c 1 $ip`;
>
> list($n,$r) = explode("packet loss, ",$res);
> list($pTime,$n) = explode("ms",$r);
> print "Ping time $pTime ms";
> ?>
>
> you can test it here:
> http://gzen.myhq.info/test/ping.php
>
>
> Ok, now several things wrong with this, first, this will only work if ping
> packets are allowed through the entire netork from you to them, inside[/color]
thier[color=blue]
> network if they are in say a corporate building. Now if they are behind a
> firewall, you will only get times to the firewall. (depends on firewall,[/color]
but[color=blue]
> most likely, firewall times)
>
> Now, this also assumes they dont have any type of stupid software like
> black-ice, (sorry to offend, but if you have a software firewall[/color]
installed[color=blue]
> on the machine you are trying to protect, your an idiot, get a solution
> before the machine you are protect!) -- ok sorry about that
>
> Also, the route that someone uses to send packets to you is not[/color]
nessasarily[color=blue]
> the route the packets take from you to them. For example. At one of my[/color]
data[color=blue]
> centers, outgoing data is routed through the least congested pipe.
>
> --
> Mike Bradley
> http://gzen.myhq.info -- free online php tools
>[color=green]
> >[/color]
>
>[/color]


CountScubula
Guest
 
Posts: n/a
#4: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


The test on my server, is a virual host, I have around 65 virtuals on that
server
rm -fr will only work on files that are the same owner/group permission


as far as 0ms, not sure, you must be realy, realy, close to me, but I didnt
see you at the office coffee maker :)

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
"Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
news:3ff47448$0$28993$ba620e4c@news.skynet.be...[color=blue]
> thanks a lot mike.
>
> I'm gettting 0 ms all the time. Is that normal ?
> Also, would this work on a virtual server? I heard Virtual servers don't
> let you execute commands with php, as you could use it to execute "rm -rf[/color]
/"[color=blue]
> or other bad things. So, they set this in their php.ini.
> What do you think ?
>
> thanks again,
>
> alexandre
> PS: nice website :)
>
> "CountScubula" <me@scantek.hotmail.com> wrote in message
> news:jKpIb.3882$pN.2576@newssvr29.news.prodigy.com ...[color=green]
> > "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> > news:3ff21d41$0$20551$ba620e4c@news.skynet.be...[color=darkred]
> > > hello !
> > >
> > > I would like to measure the time a user needs to connect to my[/color][/color][/color]
website.[color=blue][color=green][color=darkred]
> > > In other words, to perform a ping between my website and the user's
> > > computer.
> > >
> > > I'm scratching my head as to how i can do that. Does anyone know a[/color][/color][/color]
good[color=blue][color=green]
> > way[color=darkred]
> > > to make this happen?
> > >
> > > thanks a lot,
> > >
> > > alexandre
> > >[/color]
> >
> > Here you go
> > <?
> > $ip = $_SERVER['REMOTE_ADDR'];
> > $res = `ping -c 1 $ip`;
> >
> > list($n,$r) = explode("packet loss, ",$res);
> > list($pTime,$n) = explode("ms",$r);
> > print "Ping time $pTime ms";
> > ?>
> >
> > you can test it here:
> > http://gzen.myhq.info/test/ping.php
> >
> >
> > Ok, now several things wrong with this, first, this will only work if[/color][/color]
ping[color=blue][color=green]
> > packets are allowed through the entire netork from you to them, inside[/color]
> thier[color=green]
> > network if they are in say a corporate building. Now if they are behind[/color][/color]
a[color=blue][color=green]
> > firewall, you will only get times to the firewall. (depends on firewall,[/color]
> but[color=green]
> > most likely, firewall times)
> >
> > Now, this also assumes they dont have any type of stupid software like
> > black-ice, (sorry to offend, but if you have a software firewall[/color]
> installed[color=green]
> > on the machine you are trying to protect, your an idiot, get a solution
> > before the machine you are protect!) -- ok sorry about that
> >
> > Also, the route that someone uses to send packets to you is not[/color]
> nessasarily[color=green]
> > the route the packets take from you to them. For example. At one of my[/color]
> data[color=green]
> > centers, outgoing data is routed through the least congested pipe.
> >
> > --
> > Mike Bradley
> > http://gzen.myhq.info -- free online php tools
> >[color=darkred]
> > >[/color]
> >
> >[/color]
>
>[/color]


Alexandre Plennevaux
Guest
 
Posts: n/a
#5: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


look! behind you !

*-]
[color=blue][color=green]
>>rm -fr will only work on files that are the same owner/group permission[/color][/color]
i assume you are talking about the chmod parameters. i'll experiment with
that and see what happens.

thanks,

alex

"CountScubula" <me@scantek.hotmail.com> wrote in message
news:bw1Jb.4680$3C5.4005@newssvr29.news.prodigy.co m...[color=blue]
> The test on my server, is a virual host, I have around 65 virtuals on that
> server
> rm -fr will only work on files that are the same owner/group permission
>
>
> as far as 0ms, not sure, you must be realy, realy, close to me, but I[/color]
didnt[color=blue]
> see you at the office coffee maker :)
>
> --
> Mike Bradley
> http://gzen.myhq.info -- free online php tools
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff47448$0$28993$ba620e4c@news.skynet.be...[color=green]
> > thanks a lot mike.
> >
> > I'm gettting 0 ms all the time. Is that normal ?
> > Also, would this work on a virtual server? I heard Virtual servers[/color][/color]
don't[color=blue][color=green]
> > let you execute commands with php, as you could use it to execute[/color][/color]
"rm -rf[color=blue]
> /"[color=green]
> > or other bad things. So, they set this in their php.ini.
> > What do you think ?
> >
> > thanks again,
> >
> > alexandre
> > PS: nice website :)
> >
> > "CountScubula" <me@scantek.hotmail.com> wrote in message
> > news:jKpIb.3882$pN.2576@newssvr29.news.prodigy.com ...[color=darkred]
> > > "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> > > news:3ff21d41$0$20551$ba620e4c@news.skynet.be...
> > > > hello !
> > > >
> > > > I would like to measure the time a user needs to connect to my[/color][/color]
> website.[color=green][color=darkred]
> > > > In other words, to perform a ping between my website and the user's
> > > > computer.
> > > >
> > > > I'm scratching my head as to how i can do that. Does anyone know a[/color][/color]
> good[color=green][color=darkred]
> > > way
> > > > to make this happen?
> > > >
> > > > thanks a lot,
> > > >
> > > > alexandre
> > > >
> > >
> > > Here you go
> > > <?
> > > $ip = $_SERVER['REMOTE_ADDR'];
> > > $res = `ping -c 1 $ip`;
> > >
> > > list($n,$r) = explode("packet loss, ",$res);
> > > list($pTime,$n) = explode("ms",$r);
> > > print "Ping time $pTime ms";
> > > ?>
> > >
> > > you can test it here:
> > > http://gzen.myhq.info/test/ping.php
> > >
> > >
> > > Ok, now several things wrong with this, first, this will only work if[/color][/color]
> ping[color=green][color=darkred]
> > > packets are allowed through the entire netork from you to them, inside[/color]
> > thier[color=darkred]
> > > network if they are in say a corporate building. Now if they are[/color][/color][/color]
behind[color=blue]
> a[color=green][color=darkred]
> > > firewall, you will only get times to the firewall. (depends on[/color][/color][/color]
firewall,[color=blue][color=green]
> > but[color=darkred]
> > > most likely, firewall times)
> > >
> > > Now, this also assumes they dont have any type of stupid software like
> > > black-ice, (sorry to offend, but if you have a software firewall[/color]
> > installed[color=darkred]
> > > on the machine you are trying to protect, your an idiot, get a[/color][/color][/color]
solution[color=blue][color=green][color=darkred]
> > > before the machine you are protect!) -- ok sorry about that
> > >
> > > Also, the route that someone uses to send packets to you is not[/color]
> > nessasarily[color=darkred]
> > > the route the packets take from you to them. For example. At one of my[/color]
> > data[color=darkred]
> > > centers, outgoing data is routed through the least congested pipe.
> > >
> > > --
> > > Mike Bradley
> > > http://gzen.myhq.info -- free online php tools
> > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Alexandre Plennevaux
Guest
 
Posts: n/a
#6: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


on my virtual server, i don't even get the "0" ms. it just returns "Ping
time ms".
i tried different chmod configs, with same owner/group params, to no avail.

??


"CountScubula" <me@scantek.hotmail.com> wrote in message
news:bw1Jb.4680$3C5.4005@newssvr29.news.prodigy.co m...[color=blue]
> The test on my server, is a virual host, I have around 65 virtuals on that
> server
> rm -fr will only work on files that are the same owner/group permission
>
>
> as far as 0ms, not sure, you must be realy, realy, close to me, but I[/color]
didnt[color=blue]
> see you at the office coffee maker :)
>
> --
> Mike Bradley
> http://gzen.myhq.info -- free online php tools
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff47448$0$28993$ba620e4c@news.skynet.be...[color=green]
> > thanks a lot mike.
> >
> > I'm gettting 0 ms all the time. Is that normal ?
> > Also, would this work on a virtual server? I heard Virtual servers[/color][/color]
don't[color=blue][color=green]
> > let you execute commands with php, as you could use it to execute[/color][/color]
"rm -rf[color=blue]
> /"[color=green]
> > or other bad things. So, they set this in their php.ini.
> > What do you think ?
> >
> > thanks again,
> >
> > alexandre
> > PS: nice website :)
> >
> > "CountScubula" <me@scantek.hotmail.com> wrote in message
> > news:jKpIb.3882$pN.2576@newssvr29.news.prodigy.com ...[color=darkred]
> > > "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> > > news:3ff21d41$0$20551$ba620e4c@news.skynet.be...
> > > > hello !
> > > >
> > > > I would like to measure the time a user needs to connect to my[/color][/color]
> website.[color=green][color=darkred]
> > > > In other words, to perform a ping between my website and the user's
> > > > computer.
> > > >
> > > > I'm scratching my head as to how i can do that. Does anyone know a[/color][/color]
> good[color=green][color=darkred]
> > > way
> > > > to make this happen?
> > > >
> > > > thanks a lot,
> > > >
> > > > alexandre
> > > >
> > >
> > > Here you go
> > > <?
> > > $ip = $_SERVER['REMOTE_ADDR'];
> > > $res = `ping -c 1 $ip`;
> > >
> > > list($n,$r) = explode("packet loss, ",$res);
> > > list($pTime,$n) = explode("ms",$r);
> > > print "Ping time $pTime ms";
> > > ?>
> > >
> > > you can test it here:
> > > http://gzen.myhq.info/test/ping.php
> > >
> > >
> > > Ok, now several things wrong with this, first, this will only work if[/color][/color]
> ping[color=green][color=darkred]
> > > packets are allowed through the entire netork from you to them, inside[/color]
> > thier[color=darkred]
> > > network if they are in say a corporate building. Now if they are[/color][/color][/color]
behind[color=blue]
> a[color=green][color=darkred]
> > > firewall, you will only get times to the firewall. (depends on[/color][/color][/color]
firewall,[color=blue][color=green]
> > but[color=darkred]
> > > most likely, firewall times)
> > >
> > > Now, this also assumes they dont have any type of stupid software like
> > > black-ice, (sorry to offend, but if you have a software firewall[/color]
> > installed[color=darkred]
> > > on the machine you are trying to protect, your an idiot, get a[/color][/color][/color]
solution[color=blue][color=green][color=darkred]
> > > before the machine you are protect!) -- ok sorry about that
> > >
> > > Also, the route that someone uses to send packets to you is not[/color]
> > nessasarily[color=darkred]
> > > the route the packets take from you to them. For example. At one of my[/color]
> > data[color=darkred]
> > > centers, outgoing data is routed through the least congested pipe.
> > >
> > > --
> > > Mike Bradley
> > > http://gzen.myhq.info -- free online php tools
> > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


CountScubula
Guest
 
Posts: n/a
#7: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


"Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
news:3ff4a649$0$6640$ba620e4c@news.skynet.be...[color=blue]
> on my virtual server, i don't even get the "0" ms. it just returns "Ping
> time ms".
> i tried different chmod configs, with same owner/group params, to no[/color]
avail.[color=blue]
>
> ??[/color]


hmm, I will look into this a bit, becouse it was raised some questions/ideas
in my head.
what can you tell me about the server, OS, httpd server (apache?), versions
etc??

(I turned around, and I saw you walk out to get check your server info, I
must say, that is a nice sweater your wearing, holiday x-mas gift?)


Mike Bradley
http://gzen.myhq.info -- free online php tools


Alexandre Plennevaux
Guest
 
Posts: n/a
#8: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


nah, funny you noticed my sweater... And not the tiger skin string i've been
wearing since the evening of december 31 until, well, now !
....oh, and you don't want to know about that sweater...
*-]

provider: onyxservers.com
OS: linux
server: apache=../apache_1.3.26-fp_2002'
php version: 4.2.3
php info: http://www.geodevlamynck.be/test/phpinfo.php

anything else ?

thanks a lot,

Alexandre

test url: http://www.geodevlamynck.be/test/alexping.php
"CountScubula" <me@scantek.hotmail.com> wrote in message
news:8O1Jb.4689$s_5.2990@newssvr29.news.prodigy.co m...[color=blue]
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff4a649$0$6640$ba620e4c@news.skynet.be...[color=green]
> > on my virtual server, i don't even get the "0" ms. it just returns "Ping
> > time ms".
> > i tried different chmod configs, with same owner/group params, to no[/color]
> avail.[color=green]
> >
> > ??[/color]
>
>
> hmm, I will look into this a bit, becouse it was raised some[/color]
questions/ideas[color=blue]
> in my head.
> what can you tell me about the server, OS, httpd server (apache?),[/color]
versions[color=blue]
> etc??
>
> (I turned around, and I saw you walk out to get check your server info, I
> must say, that is a nice sweater your wearing, holiday x-mas gift?)
>
>
> Mike Bradley
> http://gzen.myhq.info -- free online php tools
>
>[/color]


Alexandre Plennevaux
Guest
 
Posts: n/a
#9: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


i forgot to give you the test link:
http://www.geodevlamynck.be/test/alexping.php


"CountScubula" <me@scantek.hotmail.com> wrote in message
news:8O1Jb.4689$s_5.2990@newssvr29.news.prodigy.co m...[color=blue]
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff4a649$0$6640$ba620e4c@news.skynet.be...[color=green]
> > on my virtual server, i don't even get the "0" ms. it just returns "Ping
> > time ms".
> > i tried different chmod configs, with same owner/group params, to no[/color]
> avail.[color=green]
> >
> > ??[/color]
>
>
> hmm, I will look into this a bit, becouse it was raised some[/color]
questions/ideas[color=blue]
> in my head.
> what can you tell me about the server, OS, httpd server (apache?),[/color]
versions[color=blue]
> etc??
>
> (I turned around, and I saw you walk out to get check your server info, I
> must say, that is a nice sweater your wearing, holiday x-mas gift?)
>
>
> Mike Bradley
> http://gzen.myhq.info -- free online php tools
>
>[/color]


CountScubula
Guest
 
Posts: n/a
#10: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


"Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
news:3ff4adba$0$29527$ba620e4c@news.skynet.be...[color=blue]
>
> provider: onyxservers.com
> OS: linux
> server: apache=../apache_1.3.26-fp_2002'
> php version: 4.2.3
> php info: http://www.geodevlamynck.be/test/phpinfo.php
>
> anything else ?
> thanks a lot,
> Alexandre
>[/color]

try this:
you can test it here: http://www.gzentools.com/test/ttouser.php or
http://gzen.myhq.info/test/ttouser.php

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$s = microtime();
$fp = fsockopen("tcp://$ip", 1, $errno, $errstr);
$e = microtime();

$tt = $e-$s;

if ($fp)
fclose($fp);

print "Trip time: $tt ms\n";

?>

This tries to open a socket connection to the users machine (or firewall, as
I stated before), to port 1, which should not be open, if it should open, it
will close the connection, either way, it will time the proccess, since this
is not ping, we are only talking about a slight differnce of a few
milliseconds, so does it matter?

we can call this Fuzzy Ping ;)

--
Mike Bradley
http://gzen.myhq.info -- free online php tools


Alexandre Plennevaux
Guest
 
Posts: n/a
#11: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


wow, i 'm impressed ! it works !!
thank you so much for lending out your skills to me.
i'm sure your script could be useful to many people outthere, because there
is nothing available as such online. could you add it on your site?

have a good good good one, if you want, you can have my tiger string (or,
what's left of it, new year 's eve was wild )

*-*




"CountScubula" <me@scantek.hotmail.com> wrote in message
news:Qj2Jb.4696$9w6.1776@newssvr29.news.prodigy.co m...[color=blue]
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff4adba$0$29527$ba620e4c@news.skynet.be...[color=green]
> >
> > provider: onyxservers.com
> > OS: linux
> > server: apache=../apache_1.3.26-fp_2002'
> > php version: 4.2.3
> > php info: http://www.geodevlamynck.be/test/phpinfo.php
> >
> > anything else ?
> > thanks a lot,
> > Alexandre
> >[/color]
>
> try this:
> you can test it here: http://www.gzentools.com/test/ttouser.php or
> http://gzen.myhq.info/test/ttouser.php
>
> <?php
> $ip = $_SERVER['REMOTE_ADDR'];
> $s = microtime();
> $fp = fsockopen("tcp://$ip", 1, $errno, $errstr);
> $e = microtime();
>
> $tt = $e-$s;
>
> if ($fp)
> fclose($fp);
>
> print "Trip time: $tt ms\n";
>
> ?>
>
> This tries to open a socket connection to the users machine (or firewall,[/color]
as[color=blue]
> I stated before), to port 1, which should not be open, if it should open,[/color]
it[color=blue]
> will close the connection, either way, it will time the proccess, since[/color]
this[color=blue]
> is not ping, we are only talking about a slight differnce of a few
> milliseconds, so does it matter?
>
> we can call this Fuzzy Ping ;)
>
> --
> Mike Bradley
> http://gzen.myhq.info -- free online php tools
>
>[/color]


CountScubula
Guest
 
Posts: n/a
#12: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


"Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
news:3ff4b622$0$29538$ba620e4c@news.skynet.be...[color=blue]
> wow, i 'm impressed ! it works !!
> thank you so much for lending out your skills to me.
> i'm sure your script could be useful to many people outthere, because[/color]
there[color=blue]
> is nothing available as such online. could you add it on your site?
>
> have a good good good one, if you want, you can have my tiger string (or,
> what's left of it, new year 's eve was wild )
>[/color]

Blushing I am, Thank you.

I am glad it worked for you. Yea, new years was wild, I ws flinging code to
finishup my encoder, it kept breaking when people tried to use the encoded
scripts. I tend to like to solve problems, and cant let them go untill I
find a solution.

I will add it to my site, within the next few minutes. I will clean it up a
bit and call it FuzzyPing ;)


--
Mike Bradley
http://gzen.myhq.info -- free online php tools


Alexandre Plennevaux
Guest
 
Posts: n/a
#13: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


thanks again, and may God be blessed for making you the kind of people who
care about other people's problems :)


"CountScubula" <me@scantek.hotmail.com> wrote in message
news:i13Jb.4715$h17.4071@newssvr29.news.prodigy.co m...[color=blue]
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff4b622$0$29538$ba620e4c@news.skynet.be...[color=green]
> > wow, i 'm impressed ! it works !!
> > thank you so much for lending out your skills to me.
> > i'm sure your script could be useful to many people outthere, because[/color]
> there[color=green]
> > is nothing available as such online. could you add it on your site?
> >
> > have a good good good one, if you want, you can have my tiger string[/color][/color]
(or,[color=blue][color=green]
> > what's left of it, new year 's eve was wild )
> >[/color]
>
> Blushing I am, Thank you.
>
> I am glad it worked for you. Yea, new years was wild, I ws flinging code[/color]
to[color=blue]
> finishup my encoder, it kept breaking when people tried to use the encoded
> scripts. I tend to like to solve problems, and cant let them go untill I
> find a solution.
>
> I will add it to my site, within the next few minutes. I will clean it up[/color]
a[color=blue]
> bit and call it FuzzyPing ;)
>
>
> --
> Mike Bradley
> http://gzen.myhq.info -- free online php tools
>
>[/color]


Alejandro Pedraza
Guest
 
Posts: n/a
#14: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


At which point in your script is the ping command executed?

"CountScubula" <me@scantek.hotmail.com> wrote in message news:<jKpIb.3882
$pN.2576@newssvr29.news.prodigy.com>...[color=blue]
> "Alexandre Plennevaux" <alexandre@lab-au.com> wrote in message
> news:3ff21d41$0$20551$ba620e4c@news.skynet.be...[color=green]
> > hello !
> >
> > I would like to measure the time a user needs to connect to my website.
> > In other words, to perform a ping between my website and the user's
> > computer.
> >
> > I'm scratching my head as to how i can do that. Does anyone know a good[/color]
> way[color=green]
> > to make this happen?
> >
> > thanks a lot,
> >
> > alexandre
> >[/color]
>
> Here you go
> <?
> $ip = $_SERVER['REMOTE_ADDR'];
> $res = `ping -c 1 $ip`;
>
> list($n,$r) = explode("packet loss, ",$res);
> list($pTime,$n) = explode("ms",$r);
> print "Ping time $pTime ms";
> ?>
>
> you can test it here:
> http://gzen.myhq.info/test/ping.php
>
>
> Ok, now several things wrong with this, first, this will only work if ping
> packets are allowed through the entire netork from you to them, inside thier
> network if they are in say a corporate building. Now if they are behind a
> firewall, you will only get times to the firewall. (depends on firewall, but
> most likely, firewall times)
>
> Now, this also assumes they dont have any type of stupid software like
> black-ice, (sorry to offend, but if you have a software firewall installed
> on the machine you are trying to protect, your an idiot, get a solution
> before the machine you are protect!) -- ok sorry about that
>
> Also, the route that someone uses to send packets to you is not nessasarily
> the route the packets take from you to them. For example. At one of my data
> centers, outgoing data is routed through the least congested pipe.[/color]
CountScubula
Guest
 
Posts: n/a
#15: Jul 17 '05

re: how to measure the ping time between the visitor and my website ??


"Alejandro Pedraza" <alejandropedraza@yahoo.com> wrote in message
news:7c15a1b4.0401011659.19293b10@posting.google.c om...[color=blue]
> At which point in your script is the ping command executed?
>[/color]

I assume this question is to me on this piece of code?[color=blue][color=green]
> > <?
> > $ip = $_SERVER['REMOTE_ADDR'];
> > $res = `ping -c 1 $ip`;
> >
> > list($n,$r) = explode("packet loss, ",$res);
> > list($pTime,$n) = explode("ms",$r);
> > print "Ping time $pTime ms";
> > ?>[/color][/color]

it is the line $res = `ping -c 1 $ip`; $res = to output of command ping -c
1 $ip

the back ticks ` or backwords single quotes lets you execute a shell
command, its a carry over from perl
I use it alot, since I tend to write most of my shell scripts on PHP now
days.

FYI, PHP shell scripts, first line: #!/bin/php -q

BTW, I posted the fuzzyping

--
Mike Bradley
http://gzen.myhq.info -- free online php tools


Closed Thread