Advertisement
Guest User

Untitled

a guest
Jan 29th, 2013
1,204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <?php
  2. function getLinkInfos($code, $key)
  3. {
  4.     $sequence_number = mt_rand(1,99999999999);
  5.     $ch = curl_init("https://g.api.mega.co.nz/cs?id=".$sequence_number);
  6.  
  7.     $data = array(array("a" => "g", "p" => $code));                                                                    
  8.     $data_string = json_encode($data);
  9.  
  10.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  11.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  12.     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
  13.     curl_setopt($ch, CURLOPT_VERBOSE, 1);
  14.     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                    
  15.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
  16.  
  17.     $output = curl_exec($ch);
  18.  
  19.     $res = json_decode(curl_exec($ch),true);
  20.  
  21.     if(!isset($res[0]['s']) || !isset($res[0]['at']))
  22.     {
  23.         return false;
  24.     }
  25.     else
  26.     {
  27.         $key = base64_decode($key);
  28.  
  29.         $size = $res[0]['s'];
  30.         $name = $res[0]['at'];
  31.  
  32.         // HOW TO DECRYPT "at" ?
  33.  
  34.         return array('size' => $size,
  35.             'name' =>  $name );
  36.     }
  37. }
  38.  
  39. var_dump(getLinkInfos('KRgBQCaI', 'ay8OYmRbLSIokMioDWRPKjcdZDFNrubHZiMVqinNUmI'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement