FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old November 6th, 2003, 03:40 AM
madhouse madhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 57 madhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 16 m 49 sec
Reputation Power: 5
Using PHP to check status of an HTTP/FTP address??

I've got a PHP support helpdesk application that has a feature to enable the status of an HTTP or FTP address to be checked i.e. whether the address can be contacted. The method which the PHP application uses to check the HTTP/FTP address is as follows:

PHP Code:
 $noc_con fsockopen ("$row_info[ip]"$parts[1], $errno$errstr1);

            if(
$noc_con)
            {
                
$status "<span class=small>Running Normally &nbsp;&nbsp;<img src=../images/general/status-good.gif></span>";
            }
            else
            {
                
$status "<span class=small>Experiencing Problems &nbsp;&nbsp;<img src=../images/general/status-bad.gif></span>";
            } 


Now I'm not sure how the above works (I know very little about PHP) but regardless of whether I'm using the qualified domain name i.e. yourdomainname.com or the IP Address of the domain name to check the current status, it always outputs to the browser that their is a problem with the server. Which presumably means it can't be contacted, even though if I enter the domain name or IP Address directly into a browser I can see the website.
Can anyone explain to me how the code above is checking the status of the web site - is it basically pinging the Web/IP Address? If it is simply pinging the Web/IP Address this isn't going to work for me because the hosting company I use doesn't allow their servers to be pinged. In which case, is their any other method that someone can suggest, or even have an example of, to enable the status of an HTTP or FTP address to be checked?

Last edited by madhouse : November 6th, 2003 at 05:13 AM.

Reply With Quote
  #2  
Old November 6th, 2003, 06:26 AM
madhouse madhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 57 madhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 16 m 49 sec
Reputation Power: 5
ok - having looked through the PHP web site I've now got an understanding as to how the fsockopen function works. However, I'm still mystified as to why I keep getting a "false" response??!!

Any ideas??

Reply With Quote
  #3  
Old November 6th, 2003, 07:09 AM
Al Bundy's Avatar
Al Bundy Al Bundy is offline
Shoe Salesman
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Innsbruck, Austria
Posts: 29 Al Bundy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi madhouse!

two things come to mind

1) change the way you write your array ...

use
PHP Code:
 $noc_con fsockopen ($row_info['ip'], $parts[1], $errno$errstr1); 


2) i guess, $row_info['ip'] is coming out of a database ? if so, check the value of the element by printing it out with print or echo to check if it even holds a value ..

regards

Al

Reply With Quote
  #4  
Old November 6th, 2003, 08:16 AM
madhouse madhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 57 madhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 16 m 49 sec
Reputation Power: 5
Al,

I changed the way the array was written as per your example but I still seem to be getting a false response back. I then had a look in the database table that holds the server information and their is definitely a value in there for $row_info['ip'] - the value is leapfrogmda.com.

Have you got anymore ideas?

Reply With Quote
  #5  
Old November 7th, 2003, 07:05 AM
Al Bundy's Avatar
Al Bundy Al Bundy is offline
Shoe Salesman
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Innsbruck, Austria
Posts: 29 Al Bundy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi again !

well, after looking at the fsockopen function, I recognized, that the last argument is the timeout setting ...

so maybe the connection would work if it had more time ...

try
PHP Code:
 $noc_con fsockopen ($row_info['ip'], $parts[1], $errno$errstr30); 


to increase the timeout to 30 seconds ...

maybe this can help

regards

al

Reply With Quote
  #6  
Old November 7th, 2003, 08:01 AM
madhouse madhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 57 madhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 16 m 49 sec
Reputation Power: 5
Al - I tried changing the time out value but still no luck. I feel I may well have to abandon this feature of my helpdesk application. It's not a big loss but would've been nice to have it working.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Using PHP to check status of an HTTP/FTP address??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway