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
This function handles what you need
function isConnected() { // use 80 for http or 443 for https protocol $connected = @fsockopen("www.example.com", 80); if ($connected){ fclose($connected); return true; } return false; }