filesharing-website-link-checker

Gesponsorde koppelingen

PHP script bestanden

  1. filesharing-website-link-checker

« Lees de omschrijving en reacties

FILE: linkchecker.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?php
/*****
 *  Copyright 2008 Hoshang Sadiq, Zeryl
 *
 *  For more information on this script, visit:
 *  http://zeryl.net/linkchecker
 *
 *  This file is part of Zeryl Filesharing Link Checker (Z.F.L.C.)
 *
 *  Z.F.L.C. is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Z.F.L.C. is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Z.F.L.C.  If not, see <http://www.gnu.org/licenses/>.
 *******/

class linkChecker {
    private $links = array();
    private $sites = array();

    function
__construct($sites = '') {
        if(is_array($sites)) {
            $this->sites = $sites;
        }
    }

      function
addLink($link) {
          $this->links[] = $link;
    }

      function
resetLinks() {
          $this->links = array();
    }

      function
addSite($site) {
        if(is_array($sites)) {
            $this->sites[] = $site;
        }
    }

    function
checkLink($link) {
        $result = '';
        if(preg_match('/^http:\/\/(www\.)?megaupload\.com\/\?d=([A-Z0-9]{6,8})$/', $link)) {
            $result = $this->megauploadCom($link);
        }
elseif(preg_match('/^http:\/\/(www\.)?rapidshare\.com\/files\/([0-9]{7,9})\/(.*?)(\.?h?t?m?l?)?$/', $link)) {
            $result = $this->rapidshareCom($link);
        }
elseif(preg_match('/^http:\/\/(www\.)?rapidshare\.de\/files\/([0-9]{7,9})\/(.*?)(\.?h?t?m?l?)?$/', $link)) {
            $result = $this->rapidshareDe($link);
        // Heb dit vanwege phphulp gecomment zodat ik een kon laten zien om nieuwe sites to te voegen!
    //    } elseif(preg_match('/^http:\/\/(www\.)?sendspace\.com\/file\/([a-zA-Z0-9]{4,7})$/', $link)) {
    //        $result = $this->sendspaceCom($link);
    //    } elseif(preg_match('/^http:\/\/(www\.)?turboupload\.com\/download\/([a-zA-Z0-9]{10,14})$/', $link)) {
    //        $result = $this->turbouploadCom($link);

        } else {
            foreach($this->sites as $site => $siteInfo) {
                if(preg_match($siteInfo['regex'], $link)) {
                    if($siteInfo['callback']['class'] != '') {
                        $result = call_user_func(array($siteInfo['callback']['class'], $siteInfo['callback']['function']), $link);
                    }
else{
                        $result = call_user_func($siteInfo['callback']['function'], $link);
                    }
                }
            }
        }

        if($result != '' && $result['status'] == ('Found' || 'Not Found')) {
            return $result;
        }
else {
            return false;
        }
    }

    function
readLinks() {
        $allLinks = array();
        foreach($this->links as $lnk) {
            $allLinks[] = $this->checkLink($lnk);
        }

        return $allLinks;
    }



    // In this function '@' is used to make sure that we don't get any php errors if the page couldn't be downloaded..
    function getPage($url) {
        if (function_exists('curl_init')) {
            $ch = @curl_init($url);
            @
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $source = @curl_exec($ch);
            @
curl_close($ch);
        }
else if(function_exists('file_get_contents')) {
            $source = @file_get_contents($url);
        }
else {
            $url = str_replace("http://","",$url);
            if (preg_match("#/#","$url")){
                $page = $url;
                $url = @explode("/",$url);
                $url = $url[0];
                $page = str_replace($url,"",$page);
                if (!$page || $page == ""){
                    $page = "/";
                }

                $ip = gethostbyname($url);
            }
else{
                $ip = gethostbyname($url);
                $page = "/";
            }

            $open = @fsockopen($ip, 80, $errno, $errstr, 60);
            $send = "GET $page HTTP/1.0\r\n";
            $send .= "Host: $url\r\n";
            if ($_SERVER['HTTP_REFERER']){
                $send .= "Referer: {$_SERVER['HTTP_REFERER']}\r\n";
            }

            $send .= "Accept-Language: en-us, en;q=0.50\r\n";
            $send .= "User-Agent: LinkCheckerScript\r\n";
            $send .= "Connection: Close\r\n\r\n";
            @
fputs($open, $send);
            while (!feof($open)) {
                $return .= @fgets($open, 4096);
            }
            @
fclose($open);
            $return = @explode("\r\n\r\n",$return,2);
            $source = $return[1];
        }

        return $source;
    }
    
    function
megauploadCom($link) {
        $fgc = $this->getPage($link);
        preg_match('/\<b\>Filename:\<\/b\> (.*?)\<\/div\>/', $fgc, $matches);
        preg_match('/\<b\>Filesize:\<\/b\> (.*?)\<\/div\>/', $fgc, $matches2);
        preg_match('/\<b\>Description:\<\/b\> (.*?)\<\/div\>/', $fgc, $matches3);
        $ret = array();
        if(isset($matches[1]) && $matches[1] != '') {
            $ret['status'] = 'Found';
            $ret['filename'] = $matches[1];
            $ret['size'] = $matches2[1];
            $ret['desc'] = $matches3[1];
        }
else {
            $ret['status'] = 'Not Found';
            $ret['filename'] = '';
            $ret['size'] = '';
            $ret['desc'] = '';
        }

        $ret['url'] = $link;
        return $ret;
    }
    
    function
rapidshareDe($link) {
        $fgc = $this->getPage($link);
        preg_match('/\<h3\>You want to download (.*?)\<\/h3\>/', $fgc, $matches);
        $ret = array();
        if(isset($matches[1]) && $matches[1] != '') {
            $ret['status'] = 'Found';
            $ret['filename'] = $matches[1];
            $ret['size'] = 'Unknown Size';
        }
else {
            $ret['status'] = 'Not Found';
            $ret['filename'] = '';
            $ret['size'] = '';
        }

    
        $ret['url'] = $link;
        return $ret;
    }
    
    function
rapidshareCom($link) {
        $fgc = $this->getPage($link);
        preg_match('/\<p class="downloadlink"\>http:\/\/rapidshare\.com\/files\/([0-9]{0,9})\/(.*?) \<font style="color:#([a-fA-F0-9]{0,6});"\>\| ([0-9]+) (.*?){0,2}\<\/font\>\<\/p\>/', $fgc, $matches);
        $ret = array();
        if(isset($matches[0]) && $matches[0] != '') {
            $ret['status'] = 'Found';
            $ret['filename'] = $matches[2];
            $ret['size'] = $matches[4].' '.$matches[5];
        }
else {
            $ret['status'] = 'Not Found';
            $ret['filename'] = '';
            $ret['size'] = '';
        }

    
        $ret['url'] = $link;
        return $ret;
    }

    function
turbouploadCom($link) {
        $fgc = $this->getPage($link);
        $fgc = explode('<div id="process">', $fgc);
        $fgc = explode('</table>', $fgc[1]);
        $fgc = $fgc[0];
    
        preg_match_all('#\<tr\>(.*?)\<\/tr\>#s', $fgc, $tr);
        $td = explode('<td', $tr[0][0]);
        preg_match_all('/\<div align="left" class="style47"\>(.*?)\<\/div\>/s', $td[2], $file);
        $file = trim(preg_replace('/\<.*?\>/', '', $file[1][0]));
        $td = explode('<td', $tr[0][1]);
        preg_match_all('/\<div align="left"  class="style47"\>(.*?)\<\/div\>/s', $td[4], $size);
        $size = $size[1][0];
    
        $ret = array();
        if(isset($file) && $file != '') {
            $ret['status'] = 'Found';
            $ret['filename'] = $file;
            $ret['size'] = $size;
            $ret['desc'] = '';
        }
else {
            $ret['status'] = 'Not Found';
            $ret['filename'] = '';
            $ret['size'] = '';
            $ret['desc'] = '';
        }

        $ret['url'] = $link;
        return $ret;
    }
}

function
sendspaceCom($link) {
    global $linkchecker;
    $fgc = $linkchecker->getPage($link);
    preg_match('/\<b\>Name:\<\/b\> (.*?)\<br\>/', $fgc, $matches);
    preg_match('/\<b\>Size:\<\/b\> (.*?)\<br\>/', $fgc, $matches2);
    preg_match('/\<b\>Description:\<\/b\> (.*?)The download link is located below.\<\/td\>/', $fgc, $matches3);
    $ret = array();
    if(isset($matches[1]) && $matches[1] != '') {
        $ret['status'] = 'Found';
        $ret['filename'] = trim($matches[1]);
        $ret['size'] = trim(isset($matches2[1]) ? $matches2[1] : '');
        $ret['desc'] = trim(isset($matches3[1]) ? $matches3[1] : '');
    }
else {
        $ret['status'] = 'Not Found';
        $ret['filename'] = '';
        $ret['size'] = '';
        $ret['desc'] = '';
    }

    $ret['url'] = $link;
    return $ret;
}


?>



FILE: voorbeeld.php
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php
/*****
 *  Copyright 2008 Hoshang Sadiq, Zeryl
 *
 *  For more information on this script, visit:
 *  http://zeryl.net/linkchecker
 *
 *  This file is part of Zeryl Filesharing Link Checker (Z.F.L.C.)
 *
 *  Z.F.L.C. is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Z.F.L.C. is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Z.F.L.C.  If not, see <http://www.gnu.org/licenses/>.
 *******/


include ('linkchecker.php');

$sites = array(
    'turboupload.com' => array(
        'regex' => '/^http:\/\/(www\.)?turboupload\.com\/download\/([a-zA-Z0-9]{10,14})$/',
        'callback' => array(
            'class' => 'linkChecker',
            'function' => 'turbouploadCom'
        )
    ),

    'sendspace.com' => array(
        'regex' => '/^http:\/\/(www\.)?sendspace\.com\/file\/([a-zA-Z0-9]{4,7})$/',
        'callback' => array(
            'class' => '',
            'function' => 'sendspaceCom'
        )
    )
);


echo '<h1>Filesharing Link Checker</h1>';

if(isset($_POST['links'])) {
    echo '<pre>';
    $linkchecker = new linkChecker($sites);
    $links = trim(addslashes(htmlspecialchars($_POST['links'])));
    $array = explode("\n", $links);
    echo "Please be patient for the page to load fully. This operation can take a while depending on the number of links and the speed of the filesharing host.<br />";
    for($i=0;$i<count($array);$i++) {
        $lnk = trim($array[$i]);
        if($lnk != '') {
            if(substr($lnk, 0, 7) != 'http://') {
                $lnk = 'http://'.$lnk;
            }

            $result = $linkchecker->checkLink($lnk);
            if($result != '' && $result['status'] == ('Found' || 'Not Found')) {
                echo (($result['status'] == 'Found') ? '<span style="color: green">Found</span> : '.$result['url'].' : '.$result['filename'] .' ('.$result['size'].')' : '<span style="color: red">Not Found</span> : '.$result['url']).'<br>';
                $text2 .= $result['url']."\n";
                flush();
            }
        }

        $lnk = '';
        $result = '';
    }

    echo 'Done<br /><br />';
    echo '</pre>';
}

//print_r($test->checkLink('LINK HIER'));
//$test->addLink('LINK HIER');
//$test->addLink('LINK HIER');
//print_r($test->readLinks());

?>


Put all the links in the box beneath, then click on Check Links
<form action="<?php echo basename(__FILE__); ?>" method="POST">
<textarea cols="100" rows="20" name="links"></textarea>
<br />
<input type="submit" value="Check links">
</form>

This website currently supports <a href="http://www.megaupload.com/">www.megaupload.com</a>, <a href="http://www.rapidshare.com/">www.rapidshare.com</a>, <a href="http://www.rapidshare.de/">www.rapidshare.de</a>, <a href="http://www.sendspace.com/">www.sendspace.com</a>, <a href="http://www.turboupload.com/">www.turboupload.com</a><br />
<a href="http://zeryl.net/linkchecker/download.php">Download this script</a>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.