Page 1 of 1

is there an active web address at...

Posted: Sat Apr 03, 2004 2:37 am
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

Posted: Sat Apr 03, 2004 2:52 am
by malcolmboston
(look into exec ping command)
something like

Code: Select all

<? 
$comm='ping -c 1 yoursite.com'; 
$res=shell_exec($comm); 
echo $res; 
?>

Posted: Sat Apr 03, 2004 4:48 am
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.

Posted: Sun Apr 04, 2004 1:21 am
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?

Posted: Sun Apr 04, 2004 10:20 am
by jollyjumper
is fopen enabled?

Posted: Sun Apr 04, 2004 2:23 pm
by vigge89
file() is disabled?!
what strange host do you have? :?