PasteSite.Com

Recent Pastes

Sign Up!

PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...

Change the theme

If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
 
/*
    Wized IRC Bot
    Adam McPeake
    www.labs.wized.net
    
    --
    Plugin [ get Time ]
    --
    
    Created by   : Tim Davies
    Created date : 20th September 2008
    Version      : 1.0
    
*/
 
class time extends tools
{
    
    public $string;
    public $user;
    private $id;
 
    public function __construct($string, $user, $id)
    {
        $this->string = $string;
        $this->user   = $user;
        $this->id     = $id;
    }
    
    private function gettime($time){
 
        $url = "http://www.worldtimeserver.com/search.aspx";
 
        //initiate cURL connections
        $ch = curl_init();
 
        //set the target url
        curl_setopt($ch, CURLOPT_URL,$url);
 
        //How many entities intended to post
        curl_setopt($ch, CURLOPT_POST, 1);
 
        //set the post parameters.
        curl_setopt($ch, CURLOPT_POSTFIELDS,"searchfor=$time"); //lifetype allows paste
 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     
        $result= curl_exec ($ch);
        return curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
     
     
         //close CURL
        curl_close ($ch);
  
    }
 
 
    public function general()
    {
        
        if($this->string['function'] == '*time')
 
                        $time = $this->getTime($this->function['var']);
                if($time !== "http://www.worldtimeserver.com/search.aspx"){
                $doc = new DomDocument();
                @$doc->loadHTMLFile($time);
                $truetime = trim($doc->getElementById('analog-digital')->getElementsByTagName('span')->item(0)->nodeValue);
                        if($time !== "http://www.worldtimeserver.com/search.aspx"){
                    
                                 $this->speak('The current time found for '.$this->function['var'].' is $truetime');
                
                }else{
                    
                    $this->speak('That specific Timezone was not found');
            
                }    
        }
        
    }
 
}
 
?>

Reply to This Paste

(leave blank to make this paste permanent)
(if set as private)