is there an active web address at...

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

Post Reply
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

is there an active web address at...

Post by Gappa »

Hey this is something im not sure how to go about doing, althought it may well be very simple..

I have apache installed on my home computer (but not PHP or anything)

I have a webhost (which does have PHP) and I want to create a php file which would simple tell a user whether or not my home computers apache server is up and running (available or not, like is there an active http web address at *ip address*)

I was looking through the manual @ PHP.NET but wasnt sure where to look

cheers if some one can help me out
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

(look into exec ping command)
something like

Code: Select all

<? 
$comm='ping -c 1 yoursite.com'; 
$res=shell_exec($comm); 
echo $res; 
?>
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

You could also use the file command, eg. like:

Code: Select all

<?php
$content = file('http://yourwebserveraddressathome/");
?>
and check what is in $content.

A better option is to create a very simple textfile(call it online.txt) on your webserver at home, which only shows the text: online

if you would use:

Code: Select all

<?php
$content = file('http://yourwebserveraddressathome/online.txt");
?>
and see if $content contains the word online

Hope this helps you.

Greetz Jolly.
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

Post by Gappa »

dang both those commands are disabled on my host... (ell thats what i get for using free stuff)

If there any other way?
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

is fopen enabled?
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

file() is disabled?!
what strange host do you have? :?
Post Reply