Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'PHP web page for pinging' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
PHP web page for pinging
Authored by: shmuel on Dec 30, '02 02:52:48AM

I didn't want to worry about someone changing the format of their webpage and breaking my IP address utility so I created a page of my own to ping. I have a hosted website with PHP installed so I created a page with a piece of PHP like this:

<? print "<H1>" . $REMOTE_ADDR . "</H1>"; ?>
<? print "<p>" . GetHostByAddr($REMOTE_ADDR) . "</p>"; ?>

Make sure there is a carriage return between the first and second line or the grep offered here will not work.

I then use the same grep pattern offered here and a simple alteration of the same pattern to get my hostname as well.

alias myhost="wget -q -O /dev/stdout | grep '<p$
alias myip="wget -q -O /dev/stdout | grep '<H1>$


[ Reply to This | # ]