Re: Checking for internet connection.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2009-12-20 at 10:13 +1000, Angus Mann wrote:

> Hi all.
> 
> I'w writing a PHP app that is designed to run over a LAN, so internet 
> connection for the server is not really essential. Some users may 
> deliberately not connect it to the internet as a security precaution.
> 
> But I'd like the app to make use of an internet connection if it exists to 
> check for an update, and notify the user.
> 
> Is there a simple way for a PHP script to check if it has an internet 
> connection?
> 
> I thought of this :
> 
> if(fsockopen("www.google.com", 80)){
>     // we are connected
> }
> 
> Is this OK or is there something better for the purpose?
> 
> 
> 


Why can't you put the update on the same LAN server that the app
resides?

If that is not possible, what about using CURL, and update if it can
connect successfully, but don't if it cannot?

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux