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: 804
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
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: 887
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
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,339
Rep Power: 66
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default Re: Get site's ping

Yes, because the connection will be flooded, it will have a huge lag and eventually it will crash.
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
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,290
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Get site's ping

Can we do that to CodeCall?
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
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
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,339
Rep Power: 66
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
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.
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,736
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
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
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,339
Rep Power: 66
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default Re: Get site's ping

Thats great! Maybe you should try it Xav

Although there is always a workaround to avoid that.
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: 804
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
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
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,290
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Get site's ping

Oh, you guys are charming!
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
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: 189
Rep Power: 5
Whitey has a spectacular aura aboutWhitey has a spectacular aura about
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 11:43 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
sam ........ 20.00000
gaylo565 ........ 18.00000
|pH| ........ 15.00000
WingedPanther ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads