Detecting Broadband?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Z3RO21
Forum Contributor
Posts: 130
Joined: Thu Aug 17, 2006 8:59 am

Post by Z3RO21 »

Please test your connection with that and then test it with something like http://www.bandwidthplace.com/speedtest/ this will hopefully show you that it in fact does not work. Also take notice of the wealth of information other posters have given you and I hope you take notice not to base information on that script.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

It sort-of works. You'll find that once your server is under load it will report a VERY low figure die to processing limitations. Multiple refreshes will drop my speed from 100k to 30k, and I'm on a 400k connection.

It's a good trick, and it might help weed out dial-up users, but don't rely on it.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

It's not a good trick because it does not work. The processing of the script happens on the server. The only thing that script accomplishes is lagging people with a slow connection because it sends a megabyte of text.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

I'm going to contact my lawyers.

My ISP provides me with 5 megabit service... (640kilobytes)...

Your script is reporting my speed as being 125kb/s.

This is a breach of the contract that I signed.



Oh wait, never-mind, YOUR SCRIPT WILL NOT WORK!
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Your test:
Helllo User Your Net Surfing Speed is 19.989 kb/s

CNET's bandwidth test:
446.7 Kbps

Speakeasy Speed Test
550 Kbps Down
696 KbpsUp

I think it is safe to say your code does not work like you think it does.

PS I know I said I was done with this thread, but these results don't lie, so I thought I'd throw them out there.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Ick... 550kbps? Sorry to hear that...

Just tested again with speakeasys...
Helllo User Your Net Surfing Speed is 109.346 kb/s
Speakeasy reported 4342kb/s Down and 601kb/s Up...
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

I'm in the UK, I used this bandwidth test provided by ZDNet: http://specials.zdnet.co.uk/misc/band-t ... est50.html
It reported 6580.6 Kbps.

Your website reported Helllo User Your Net Surfing Speed is 111.684 kb/s, which you'll notice is very similar to what everyone else got using your script. If the script was hosted on a different server, the results would be different, but would probably be in a fixed range like yours.

Thats more than 50 times off of what it should be. The fundamentals of your script are all wrong, but they've been covered by other people, so now surely you can just read the figures and realise that even if your script was fundamentally correct that it doesn't work properly anyway.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Perhaps Its What He Need (spd.php)
==========================

Code: Select all

<?php
if(isset($_GET['kbps']))
{
?>
<?php
	$kbps = round($_GET['kbps'], 2);
	$ksec = round($kbps / 8, 2);
	$mbps = round($kbps / 1024, 2);
	$msec = round($mbps / 8, 2);
?>
<center>

<br><br>
Your Current Bandwidth is:<br><br>
<?php
   if ($mbps > 1)
    {
      printf ("%.2f",$mbps);
      echo " Mbps<br><br>";
    }
   else
    {
	  printf ("%.2f",$kbps);
      echo "kbps<br><br>";
    }
   echo "That Means You Can Download At " . $ksec . " KB/sec. FROM&nbsp;THIS&nbsp;SITE.";
?>
<br><br>
<a href="spd.php">Perform a New Test</a>
</center>
<?php
}
else
{
?>

<?php
$default_kbyte_test_size = 512;
?>
<html>
	<head>
		<title>Bandwidth Test</title>
		<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
		<META HTTP-EQUIV="Expires" CONTENT="Fri, Jun 12 1981 08:20:00 GMT"> 
		<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
		<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
		<link rel="stylesheet" href="style.css">
	</head>

	<body>
		<center>
<br><br><br><br><br><br>
						Testing Your Current Bandwidth...

<script language="JavaScript">
<!--
	time      = new Date();
	starttime = time.getTime();
// -->
</script>

<?php
    // $data_file Should Be A Junk Binary File I Tested It With a 3 MB file.
    //Use Any Binary File And Just Rename It
    //I Just Used A ZIpped Backup File Of Mine
	$data_file = "A_Sample_binary_file.zip";
	$fd = fopen ($data_file, "rb+");

	$test_kbytes = $default_kbyte_test_size;

	$contents = fread ($fd, $test_kbytes * 1024);
		
	echo "<!-- $contents -->";
	fclose ($fd);

?>
<script language="JavaScript">
<!--
	time          = new Date();
	endtime       = time.getTime();
	if (endtime == starttime)
		{downloadtime = 0
		}
	else
	{downloadtime = (endtime - starttime)/1000;
	}

	kbytes_of_data = <?php echo $test_kbytes; ?>;
	linespeed     = kbytes_of_data/downloadtime;
	kbps          = (Math.round((linespeed*8)*10*1.024))/10;
 	nexturl = 'spd.php?kbps='+ kbps;
    //alert(kbytes_of_data);
    document.location.href=nexturl;
// -->
</script>
<center>
</body>
</html>
<?php
}
?>
==========================================================
== DONT TEST ON LOCALHOST UPLOAD THIS FILE AND THE BINARY FILE ==
== TO A SERVER AND THEN TEST IT ==
== IT WOULD BE GOOD IF YOU USE A BINARY FILE THATS MORE THAN 2 MB ==
==========================================================
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

You just don't seem to get it do you?
Your Current Bandwidth is:

256.00 Mbps

That Means You Can Download At 32768 KB/sec. FROM THIS SITE.
I highly doubt it...

I HIGHLY recommend you go back to school, or perhaps buy an introduction to networking book...
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Be nice guys.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

rofl @ 32 megabytes a second.

I second the motion for a book.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

nickvd wrote:You just don't seem to get it do you?
Your Current Bandwidth is:

256.00 Mbps

That Means You Can Download At 32768 KB/sec. FROM THIS SITE.
I highly doubt it...

I HIGHLY recommend you go back to school, or perhaps buy an introduction to networking book...
I Have Told It Before That Dont do it On Your localhost
Cause When You are Testing it In Localhost No Internet Connection Is Required.
If The Binary File Is Also On localhost Then How Could It Tell It Your Speed
It Would Be Just Funny
You PLease Upload It And the Binary File Then Test It

I Dont Know A Free server Where I Can Upload It To Test If Anybody Know's Pls ell Me I'll Test It
Z3RO21
Forum Contributor
Posts: 130
Joined: Thu Aug 17, 2006 8:59 am

Post by Z3RO21 »

neel_basu wrote:I Have Told It Before That Dont do it On Your localhost
They are not testing on localhost but remote host just as I did. My results were about the same.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Here, I wrote a script that you might use instead:

Code: Select all

echo "You're connection clocks in at " . rand() . "mb/s (" . rand() . "kb/s)";
I haven't tested this, but it should work.
konstandinos
Forum Commoner
Posts: 68
Joined: Wed Oct 04, 2006 4:20 am

Post by konstandinos »

aaronhall wrote:Here, I wrote a script that you might use instead:

Code: Select all

echo "You're connection clocks in at " . rand() . "mb/s (" . rand() . "kb/s)";
I haven't tested this, but it should work.
that's quite simply the funniest post i've ever come across.
Post Reply