Skip to content

Instantly share code, notes, and snippets.

@nunocodex
Created June 6, 2010 03:02
Show Gist options
  • Save nunocodex/427246 to your computer and use it in GitHub Desktop.
Save nunocodex/427246 to your computer and use it in GitHub Desktop.
<?php
class Rapidshare_Com
{
/**
* @var string
*/
public static $cookie = 'rs_cookie_data.php';
public function __construct()
{
// Controllo se è attivo cURL.
if ( ! function_exists('curl_init') )
{
die('cURL not found.');
}
}
/**
* Login
*
* @return array
* @author Namaless
**/
public static function login($username, $password)
{
$post_data = array
(
'login' =&gt; $username,
'password' =&gt; $password
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEJAR, self::$cookie);
$buffer = curl_exec($ch);
$error = curl_errno($ch);
$info = curl_getinfo($ch);
curl_close($ch);
// controllo se il login è stato effettuato correttamente.
return strpos($buffer, $username);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment