Tuesday, March 22, 2011

Check whether site is down or good using php

Below is the function to check whether the site is down or good using php.

function VisitSite($url){
    $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL,$url );
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch,CURLOPT_VERBOSE,false);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $page=curl_exec($ch);
    //echo curl_error($ch);
    $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    if($httpcode >= 200 && $httpcode < 300){
        return true;
    }
    else {
        return false;
    }
}
if(VisitSite('http://www.google.com')){
       echo "Website looks Good";
}else{
      echo "Website looks Down";
}
 

Saturday, March 5, 2011

Photoshop Shortcuts

Photoshop shortcuts. Please check the below image for the photograph shortcuts. This may help you.

If I miss any of them, please make a comment so that I can also know it.