rem42 | Bonjour,
J'ai un petit souci lors que je souhaite supprimer un fichier des serveurs de filesonic avec la méthode Curl !
Voici ce que j'ai fait :
Code :
- <?
- function GetCookieFS($user, $pass, $cookieFS){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'http://www.filesonic.com/user/login/');
- curl_setopt ($ch, CURLOPT_POST, 1);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, 'redirect=%2Fuser%2Flogin&email='.$user.'&password='.$pass.'&rememberMe=0&controls%5Bsubmit%5D=');
- curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookieFS);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
- $store = curl_exec ($ch);
- $content = curl_exec ($ch);
- curl_close ($ch);
- }
- $cookiep = realpath("cookie_fo.txt" );
- $ufscookie = GetCookieFS("pseudo", "mdp", $cookiep);
- $cookiep = realpath("cookie_fo.txt" );
- if($link == 'true')
- {
- $fp = fopen($cookiep, "w" );
- fclose($fp);
- }
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiep);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiep);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_URL, 'http://www.filesonic.fr/filesystem/delete/F569129294'); // Lien du fichier
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_REFERER, 'http://www.filesonic.fr/filesystem/browse');
- curl_setopt($ch, CURLOPT_HEADER, TRUE);
- curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
- curl_setopt($ch, CURLOPT_POST, TRUE);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'redirect=/filesystem/browse&files%5B%5D=F569129294&controls%5Bsubmit%5D='); //Les variables postés, lors de la validation de la suppression
- ob_start();
- return curl_exec ($ch); // execute the curl command
- ob_end_clean();
- curl_close ($ch);
- unset($ch);
- ?>
|
Merci d'avance !!
Cordialement
rem42 |