Lost Password?

  #1 (permalink)  
Old 04-29-2008, 06:23 AM
Jaan's Avatar   
Jaan Jaan is offline
Moderator
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 444
Last Blog:
Wadio Media Layout Com...
Rep Power: 9
Jaan will become famous soon enoughJaan will become famous soon enough
Send a message via MSN to Jaan
Default Get site's ping

I used this script once.. and today I found it and I thought I'll make ta tutorial about it.. It's very very simple so you will learn it quickly

First.. we have to create a new function.

PHP Code:
<?php
function track($host$port$timeout) {
It will create a new function "track" that requires host, port and timeout parameters..

PHP Code:
$firstTime microtime(true); 
$firstTime = microtime(true); - It will get a first time in microseconds

Now let's connect to this site

PHP Code:
$sock fSockOpen($host$port$errno$errstr$timeout); 
$sock = fSockOpen($host, $port, $errno, $errstr, $timeout); - This function/variable connects to the site

If that $sock variable don't get a response then let's display the error

PHP Code:
if (!$sock) { 
echo 
"<b>Offline</b>"

Now let's get the another time

PHP Code:
$secondTime microtime(true); 
And now let's get the response time, let's show it and close our function

PHP Code:
$ping round((($secondTime $firstTime) * 1000), 0);
echo 
$ping." ms";

$ping = round((($secondTime - $firstTime) * 1000), 0); - Calculates the ping
echo $ping." ms"; - Shows the ping
} - Ends our function

Now let's get CodeCall.Net's ping

PHP Code:
track("www.codecall.net"8010);
?> 
I told you it is simple
Here's the full script:

PHP Code:
<?php
function track($host$port$timeout) {
$firstTime microtime(true);
$sock fSockOpen($host$port$errno$errstr$timeout);
if (!
$sock) { 
echo 
"<b>Offline</b>"
}
$secondTime microtime(true);
$ping round((($secondTime $firstTime) * 1000), 0);
echo 
$ping." ms";
}

track("www.codecall.net"8010);
?>
__________________


Cheap & Professional Web Design | Need help? Send a PM

Last edited by Jaan; 05-22-2008 at 06:14 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-18-2008, 07:39 PM
DevilsCharm's Avatar   
DevilsCharm DevilsCharm is offline
Programming God
 
Join Date: Jul 2006
Posts: 880
Rep Power: 13
DevilsCharm is on a distinguished road
Default Re: Get site's ping

I hear if a lot of people (A LOT) ping a site at once it goes down. Is that true?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-19-2008, 05:57 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default Re: Get site's ping

Yes, because the connection will be flooded, it will have a huge lag and eventually it will crash.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-20-2008, 03:16 PM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 3,069
Last Blog:
Reading Jet Databases ...
Rep Power: 27
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Get site's ping

Can we do that to CodeCall?
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-21-2008, 06:43 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default Re: Get site's ping

Well... Not so simple. I will need 1000's of computers pinging at the same time. It also depends on the connection and server.

For example the old server of CC used to crash many times, because it had many users trying to access the website at the same time.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 05-21-2008, 06:51 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,364
Last Blog:
PHPUnit
Rep Power: 50
John is a glorious beacon of lightJohn is a glorious beacon of lightJohn is a glorious beacon of lightJohn is a glorious beacon of lightJohn is a glorious beacon of light
Send a message via AIM to John
Default Re: Get site's ping

Quote:
Originally Posted by Xav View Post
Can we do that to CodeCall?
If you try it, your IP address will automatically be banned from the entire server.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-21-2008, 09:14 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default Re: Get site's ping

Thats great! Maybe you should try it Xav

Although there is always a workaround to avoid that.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-21-2008, 12:39 PM
Jaan's Avatar   
Jaan Jaan is offline
Moderator
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 444
Last Blog:
Wadio Media Layout Com...
Rep Power: 9
Jaan will become famous soon enoughJaan will become famous soon enough
Send a message via MSN to Jaan
Default Re: Get site's ping

Quote:
Originally Posted by TcM View Post
Thats great! Maybe you should try it Xav

Although there is always a workaround to avoid that.

lol dude
__________________


Cheap & Professional Web Design | Need help? Send a PM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-21-2008, 12:48 PM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 3,069
Last Blog:
Reading Jet Databases ...
Rep Power: 27
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Get site's ping

Oh, you guys are charming!
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 05-31-2008, 01:06 AM
Whitey's Avatar   
Whitey Whitey is offline
Programmer
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 140
Rep Power: 3
Whitey will become famous soon enoughWhitey will become famous soon enough
Send a message via AIM to Whitey Send a message via MSN to Whitey Send a message via Skype™ to Whitey
Default Re: Get site's ping

Correct me if i am wrong. but isn't that what they do when they use a program called DDoS. It pings a server/website till its flooded and shut down?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Build Custom Templates For Your Data-Driven Web Sites Kernel Programming News 0 04-28-2008 07:19 AM
How to Ping A Site !!!! kresh7 Visual Basic Programming 4 11-19-2007 02:45 PM
Template Sites TVDinner Website Design 4 06-01-2007 10:32 PM
Large list of PAD enabled shareware web sites UtilityW Shareware Sites 2 08-24-2006 08:56 PM
Large list of PAD enabled shareware web sites UtilityW Marketing 5 07-21-2006 10:45 AM


All times are GMT -5. The time now is 01:54 AM.

Contest Stats

dargueta ........ 93.00000
John ........ 87.50000
Xav ........ 70.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads