public
Description: PHP Class for Phishtank (MIT Licensed)
Homepage: http://cowsandmilk.net/PhishTank/
Clone URL: git://github.com/cowsandmilk/cowphishtank.git
cowphishtank / PhishTank_Url.php
100644 132 lines (120 sloc) 4.051 kb
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* This takes the data from Phishtank about whether or not a url
* is in the database, is verified, and is a Phish and turns
* it into an easier to use form.
*
* @author David Hall <dhall@wustl.edu>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link http://cowsandmilk.homedns.org/PhishTank/
* @see PhishTank
*/
class PhishTank_Url {
 
    /**
* The url, which you wouldn't necessarily know what it was in the case
* of submitting an email
*
* @var string
*/
    public $url;
    
    /**
* It should be obvious
*
* @var string
*/
    public $in_database;
    
    /**
* If its in the database, this is the id
*
* @var string
*/
    public $phish_id;
    
    /**
* If in the database, the url for the page for info and voting
*
* @var string
*/
    public $phish_detail_page;
    
    /**
* Is it verified? You have to ask other people what this means
*
* @var string
*/
    public $verified;
    
    /**
* If verified, when
*
* @var string
*/
    public $verified_at;
    
    /**
* Is it valid? I think this says if its really a Phish
*
* @var string
*/
    public $valid;
    
    /**
* when was it submitted?
*
* @var string
*/
    public $submitted_at;
    
    /**
* If you are submitting urls, this says if they added the url to the database
* The only reason I know not to accept is if its already there, and since
* the methods in PhishTank check this, I think this should always be true,
* but who knows??
*
* @var string
*/
    public $accepted;
 
    /**
* This reads the simplexml object created from the xml response of OpenDNS and
* puts everything into the object properties as strings.
*
* @param SimpleXMLElement $urlXML the response from OpenDNS
* @param string $source Whether you were checking for a Phish or submitting a Phish
*/
    public function __construct($urlXML, $source = 'check')
    {
        if ($source == 'check') {
            $this->url = (string) $urlXML->url;
            $this->in_database = (string) $urlXML->in_database;
            $this->phish_id = ($urlXML->phish_id instanceof SimpleXMLElement)
                               ? (string) $urlXML->phish_id
                               : '';
            $this->phish_detail_page = ($urlXML->phish_detail_page instanceof SimpleXMLElement)
                                ? (string) $urlXML->phish_detail_page
                                : '';
            $this->verified = ($urlXML->verified instanceof SimpleXMLElement)
                                ? (string) $urlXML->verified
                                : '';
            $this->verified_at = ($urlXML->verified_at instanceof SimpleXMLElement)
                                ? (string) $urlXML->verified_at
                                : '';
            $this->valid = ($urlXML->valid instanceof SimpleXMLElement)
                                ? (string) $urlXML->valid
                                : '';
            $this->submitted_at = ($urlXML->submitted_at instanceof SimpleXMLElement)
                                ? (string) $urlXML->submitted_at
                                : '';
        } elseif ($source == 'submit') {
            $this->accepted = (string) $urlXML->accepted;
            $this->phish_id = ($urlXML->phish_id instanceof SimpleXMLElement)
                                ? (string) $urlXML->phish_id
                                : '';
            $this->phish_detail_page = ($urlXML->phish_id instanceof SimpleXMLElement)
                                ? 'http://www.phishtank.com/phish_detail.php?phish_id=' . (string) $urlXML->phish_id
                                : '';
}
}
}
 
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>