How can I check if I\'m connected to the internet from my PHP script which is running on my dev machine?
I run the script to download a set of files (which may or ma
The accepted answer did not work for me. When the internet was disconnected it threw a php error. So I used it with a little modification which is below:
if(!$sock = @fsockopen('www.google.com', 80)) { echo 'Not Connected'; } else { echo 'Connected'; }