Mam otóż taki mały problem ponieważ w moim skrypcie nie działa pobieranie z wupload.com
Oto kod pliku odpowiadającego za pobieranie:
<?php
require_once 'navigator.php';
require_once 'units.php';
class Wupload {
public static function getName($url) {
if(substr($url, 0, 11) != 'http://www.') { $url='http://www.'.substr($url, 7); }
$options = array(
CURLOPT_FAILONERROR => True,
CURLOPT_RETURNTRANSFER => True,
CURLOPT_TIMEOUT => 25,
CURLOPT_POST => false,
CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
CURLOPT_HEADER => True,
);
$result = Navigator::retrievePage($url, $options);
$matches = NULL;
if (preg_match('/<title>Get (.*?) on Wupload\.com<\/title/is', $result, $matches) < 1)
return FALSE;
return trim($matches[1]);
}
public static function getSize($url) {
$options = array(
CURLOPT_FAILONERROR => True,
CURLOPT_RETURNTRANSFER => True,
CURLOPT_TIMEOUT => 25,
CURLOPT_POST => false,
CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
CURLOPT_HEADER => True,
);
$result = Navigator::retrievePage($url, $options);
$matches = NULL;
if (preg_match('/<span class="size">(.*?)<\/span/is', $result, $matches) < 1)
return -1;
$size = trim($matches[1]);
$size = explode(' ', $size); // Explode the size and abbreviation
$unitname = AUnit::instance()->getUnitnameByAbbreviation('digital', $size[1]);
return AUnit::Instance()->convert_digital($size[0], $unitname, 'kilobyte')->getSize();
}
public static function downloadLink($url, $userName = null, $password = null) {
preg_match("/^http\:\/\/?www\.*wupload\.com(\/.*?)$/", $url, $matches);
$redirectUrl = $matches[1];
$loginUrl = 'http://www.wupload.com/account/login';
$cookiesFileName = tempnam(sys_get_temp_dir(), 'BZL');
$options = array(
CURLOPT_FAILONERROR => True,
CURLOPT_RETURNTRANSFER => True,
CURLOPT_TIMEOUT => 25,
CURLOPT_SSL_VERIFYPEER => False,
CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
CURLOPT_POST => True,
CURLOPT_POSTFIELDS => array(
'email' => $userName,
'password' => $password,
'rememberMe' => '1',
'redirect' => $redirectUrl,
),
CURLOPT_COOKIEJAR => $cookiesFileName,
// CURLOPT_HEADER => True
);
$result = Navigator::retrievePage($loginUrl, $options);
$link = Navigator::retrieveLocationRedirect($result);
return $link;
}
}
/*
$url = 'http://www.netload.in/dateigFaIysgPfb.htm';
echo Netload::getName($url);
echo Netload::downloadLink($url, '535894', '***');
*/
Ja nie widzę tutaj błędów. Może ktoś z was zauważy. Z góry dzięki za pomoc.