Ver Mensaje Individual
  #7 (permalink)  
Antiguo 10/09/2011, 14:31
Avatar de ahaugas
ahaugas
 
Fecha de Ingreso: agosto-2011
Ubicación: Madrid
Mensajes: 249
Antigüedad: 12 años, 8 meses
Puntos: 21
Respuesta: problemas con php

NO ME FUNCIONA o no lo estoy poniendo bien HE PUESTO ESTO como me has dicho


Código PHP:
Ver original
  1. if ($content = curl_init("http://www.megavideo.com/xml/videolink.php?v=".$megavideo_id."&u=XXXXXXXXXXXXXXXXXXXXXXXX--XXXXX")){
  2.     curl_setopt($content, CURLOPT_RETURNTRANSFER, true);
  3.     $var = curl_exec($content);
  4.     curl_close($content);


el codigo original es este


Código PHP:
Ver original
  1. <?php
  2.     // For premium accounts
  3.     // It downlad the video in flv format
  4.     // It doesnt work if the file is hosted on free hosting, but works from hosting like dreamhost.
  5.     // The parameter that is after u= (in the line 46) is your megavideo premium cookie. To find it use firefox + temper data and watch a movie, you could find it there. Every user has a different cookie
  6.     // How to call the file: http://website.com/mvpremiumflv.php?video_id=IDOFTHEVIDEO
  7.     function mv_decrypt($str_hex, $key1, $key2){
  8.     $str_bin = "";
  9.     // 1. Convert hexadecimal string to binary string
  10.     for($i = 0; $i < 128; $i++){
  11.     $str_bin .= floor(hexdec($str_hex[floor($i/4)])/pow(2,(3-($i%4))))%2;
  12.     }
  13.     // 2. Generate switch and XOR keys
  14.     $key = Array();
  15.     for ($i = 0; $i < 384; $i++){
  16.     $key1 = ($key1 * 11 + 77213) % 81371;
  17.     $key2 = ($key2 * 17 + 92717) % 192811;
  18.     $key[$i] = ($key1 + $key2) % 128;
  19.     }
  20.     // 3. Switch bits positions
  21.     for ($i = 256; $i >= 0; $i--){
  22.     $temp = $str_bin[$key[$i]];
  23.     $str_bin[$key[$i]] = $str_bin[$i%128];
  24.     $str_bin[$i%128] = $temp;
  25.     }
  26.     // 4. XOR entire binary string
  27.     for ($i = 0; $i < 128; $i++){
  28.     $str_bin[$i] = $str_bin[$i] ^ $key[$i+256] & 1;
  29.     }
  30.     // 5. Convert binary string back to hexadecimal
  31.     $str_hex = "";
  32.     for($i = 0; $i < 32; $i++){
  33.     $str_hex .= dechex(bindec(substr($str_bin, $i*4, 4)));
  34.     }
  35.     // 6. Return counted string
  36.     return $str_hex;
  37.     }
  38.  
  39.     // Is set the "video_id" variable?
  40.     if(isset($_GET["video_id"])){
  41.     // Does player send video position?
  42.     $pos = (isset($_GET["pos"]) ? intval($_GET["pos"]) : "");
  43.     //Obtain Megavideo ID from link
  44.     $megavideo_id = $_GET["video_id"];
  45.     // Obtain Megavideo XML playlist file
  46.     if ($content = file_get_contents("http://www.megavideo.com/xml/videolink.php?v=".$megavideo_id."&u=XXXXXXXXXXXXXXXXXXXXXXXX--XXXXXX")){
  47.     // Parameters which I want to obtain from XML;
  48.     $parameters = Array("un", "k1", "k2", "s", "size");
  49.     $success = true;
  50.     // Obtain parameters from XML one by one
  51.     for($i=0; $i<Count($parameters); $i++){
  52.     $success = $success && preg_match('/ ' . $parameters[$i] . '="([^"]+)"/', $content, $match);
  53.     $$parameters[$i] = $match[1];
  54.     }
  55.     if($success){
  56.     // Count "dkey" from obtained parameters
  57.     $dkey=mv_decrypt($un,$k1,$k2);
  58.     // set URL address of video file
  59.     $video_url = "http://www".$s.".megavideo.com/files/".$dkey."/".$pos;
  60.     // Send headers to browser
  61.     header("Content-Type: video/flv");
  62.     header("Content-Disposition: attachment; filename=video.flv;" );
  63.     header("Content-Length: ".$size);
  64.     // Read video file from Megavideo server
  65.     readfile($video_url);
  66.     }
  67.     }
  68.     }
  69.     ?>