COLORADO: 5:13 am
JAPAN: 8:13 pm

-1189 days for S+Y!



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: PHP :: check to see if a website is up or down
PostPosted: Wed Jul 10, 2013 3:01 pm 
SysOp
User avatar

Joined: Sun Nov 08, 2009 7:03 pm
Posts: 1550
Location: Colorado
Code:

<?php
// make sure site is up
//  more code at phuturecode.com
// uncomment to show errors
// error_reporting(-1);

// set the URL
 $url="http://examplewebsite.com";
 
           
           $cl = curl_init($url);
           curl_setopt($cl,CURLOPT_CONNECTTIMEOUT, 2);
           curl_setopt($cl, CURLOPT_TIMEOUT, 3);
           curl_setopt($cl,CURLOPT_HEADER,true);
           curl_setopt($cl,CURLOPT_NOBODY,true);
           curl_setopt($cl,CURLOPT_RETURNTRANSFER,true);
 
           //get response
           $response = curl_exec($cl);
 
           curl_close($cl);
 
           if ($response) echo 'site up';
 
        else   echo 'site down';
 ?>


_________________
Contact me directly: Ironfeatherbooks (@) gmail.com

Image

Bookmark and Share



Top
 OfflineProfile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 3 guests



Search for:
cron

This site contains adult natured content. All material submitted to this site is the sole responsibility of the submitter.

© 2023 Iron Feather Journal

 

Recent Visitors: