Results 1 to 9 of 9
-
05-29-2008, 10:04 AM #1Newbie
- Join Date
- Apr 2008
- Posts
- 25
Network Programming with PHP question
In the future I might need to create a script that tallies the domains on a shared IP and pings them..among other things. I was just wondering if this is possible with PHP or do I need to use shell scripting?
Optimize Your Web Hosting Operation - Empire Consultant
-
05-29-2008, 10:29 AM #2Hail Eris !
- Join Date
- Oct 2002
- Location
- Canada
- Posts
- 3,103
PHP can manipulate raw sockets so yes, you could implement ICMP communication in PHP.
-
05-29-2008, 12:16 PM #3Junior Guru Wannabe
- Join Date
- Mar 2007
- Location
- UK
- Posts
- 89
-
05-29-2008, 01:52 PM #4Newbie
- Join Date
- Apr 2008
- Posts
- 25
Cool thanks!
If you guys know of any good sites with regards to network programming with php please let me know.Optimize Your Web Hosting Operation - Empire Consultant
-
05-29-2008, 02:24 PM #5Aspiring Evangelist
- Join Date
- Dec 2007
- Location
- Lebanon
- Posts
- 413
I think you will need some shell scripting through php though!! not tough scripting but some shell commands
-
05-29-2008, 09:40 PM #6Junior Guru
- Join Date
- Nov 2006
- Location
- College Station, TX
- Posts
- 185
The sockets API in PHP is pretty much just a direct layer over the C sockets API, so that should be pretty easy to figure out if you're smart enough to be messing with it.
For an easier route, though -- just have PHP make some exec calls to ping or fping. I'd suggest fping.
And if you'd like to avoid this all together -- install Nagios.
-
05-30-2008, 09:20 AM #7Newbie
- Join Date
- Apr 2008
- Posts
- 25
Optimize Your Web Hosting Operation - Empire Consultant
-
05-30-2008, 11:34 AM #8Junior Guru
- Join Date
- Nov 2006
- Location
- College Station, TX
- Posts
- 185
You can get nagios to do anything. All you need to do is write a plugin (if one doesn't already exist) to watch it and either report "OK" or "WARNING" or "CRITICAL" to standard out. You can write these scripts in PHP, Bash, C, Perl, and pretty much anything else that can, well, output a line of text to standard out.
-
06-02-2008, 01:58 PM #9Newbie
- Join Date
- Apr 2008
- Posts
- 25
Ohh I like that
Thanks for the info, I appreciate it.Optimize Your Web Hosting Operation - Empire Consultant