Bonjour,
Voici le détail :
//Telechargement en mode premium
private function DownloadPremium()
{
$ret = false;
$DownloadInfo = array();
$ret = $this->UrlFilePremium();
if($ret == false)
{
$DownloadInfo[DOWNLOAD_ERROR] = ERR_FILE_NO_EXIST;
}else
{
//AJOUT
$this->GenerateRequest($ret);
$page = $this->UrlFileFree(true);
preg_match($this->FILE_URL_REGEX,$page,$urlmatch);
if(!empty($urlmatch[1]))
{
$DownloadInfo[DOWNLOAD_URL] = $urlmatch[1];
}else{
$DownloadInfo[DOWNLOAD_ERROR] = ERR_FILE_NO_EXIST;
}
$DownloadInfo[DOWNLOAD_FILENAME] = $this->TAB_REQUEST[$this->STRING_FNAME];
//FIN AJOUT
//COMMENTER : $DownloadInfo[DOWNLOAD_URL] = $ret;
$DownloadInfo[DOWNLOAD_COOKIE] = $this->COOKIE_FILE;
}
return $DownloadInfo;
}
//renvoie la vrai url du fichier en mode premium. Ou false si elle n'est pa affiché
private function UrlFilePremium()
{
$ret = false;
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERAGENT, DOWNLOAD_STATION_USER_AGENT);
curl_setopt($curl, CURLOPT_URL, $this->Url);
curl_setopt($curl, CURLOPT_COOKIEFILE, $this->COOKIE_FILE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
$header = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
$error_code = $info['http_code'];
if ($error_code == 301 || $error_code == 302)
{
$ret = $info['redirect_url'];
}
preg_match($this->ERROR_404_URL_REGEX, $ret, $finderror);
if(isset($finderror[0]))
{
$ret = false;
}
//AJOUT
else{
$ret = $header;
}
return $ret;
}
Bonne réception, a+