Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Problem] Missing argument
Forum PHP.pl > Forum > PHP
fuqet
Witam, mam taki skrypt jak poniżej

  1. <?php
  2. /************* MegaVideo Downloader *******************/
  3. /*
  4. Released by AwesomePHP.com, under the GPL License, a
  5. copy of it should be attached to the zip file, or
  6. */
  7. /************* MegaVideo Downloader *******************/
  8.  
  9. // Cookie File
  10. $COOKIE_FILE = 'mv_cookie.txt';
  11.  
  12. //MegaVideo Username (premium)
  13. $USERNAME = 'login';
  14.  
  15. //MegaVideo Password (premium)
  16. $PASSWORD = 'haslo';
  17.  
  18. /*
  19. get_url function is invoked when
  20. the movie file is the flash and not
  21. the movie page
  22. */
  23. function get_url($id){
  24. $fp = fsockopen ('www.megavideo.com', '80', $errno, $errstr, 30);
  25. if ($fp){
  26. $query = "GET /v/$id HTTP/1.1\r\n";
  27. $query .= "Host: www.megavideo.com\r\n\r\n";
  28. fputs($fp, $query);
  29. while (!feof($fp)){
  30. $buf .= fgets($fp,128);
  31. }
  32. fclose ($fp);
  33. } else {
  34. return NULL;
  35. }
  36. preg_match("/location: (.+)\n/U", $buf, $url);
  37. $temp = explode('v=',$url[1]);
  38. $temp2 = explode('&',$temp[1]);
  39. return "http://www.megavideo.com/?v=".$temp2[0];
  40. }
  41.  
  42. /*
  43. function to get the download link
  44. from megavideo
  45. */
  46. function get_dlink($vlink,$COOKIE_FILE,$USERNAME,$PASSWORD){
  47. /*
  48. If cookie file doesn't exist, it means we need to login
  49. */
  50. if(!is_file($COOKIE_FILE)){
  51. //URL
  52. $url = 'http://www.megavideo.com/?s=signup';
  53.  
  54. /* Post Data */
  55. $postData['nickname'] = $USERNAME;
  56. $postData['password'] = $PASSWORD;
  57. $postData['action'] = 'login';
  58.  
  59. $ch = curl_init();
  60. curl_setopt($ch, CURLOPT_URL,$url);
  61. curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  62. curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  63. curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  64. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  65. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  66. curl_setopt($ch, CURLOPT_TIMEOUT, 50);
  67. curl_setopt($ch, CURLOPT_POST, 1);
  68. curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
  69. $buffer = curl_exec($ch);
  70. curl_close($ch);
  71. }
  72. /*
  73. Check link format, and if we need to get
  74. link of actual movie page
  75. */
  76. if(eregi('/v/',$vlink)){
  77. $temp = explode('v/',$vlink);
  78. $final_link = get_url($temp[1]);
  79. } else {
  80. $final_link = $vlink;
  81. }
  82.  
  83. $ch = curl_init();
  84. curl_setopt($ch, CURLOPT_URL,$vlink);
  85. curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  86. curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  87. curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  88. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  89. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  90. curl_setopt($ch, CURLOPT_TIMEOUT, 50);
  91. $buffer = curl_exec($ch);
  92. curl_close($ch);
  93. preg_match('|BORDER="0" ALT=""></a> <a href="(http.*)" target="_blank" style="font-weight:normal; ">Download original</a>|U',$buffer,$result);
  94. return $result[1];
  95. }
  96.  
  97. /*
  98. Test
  99. */
  100.  
  101. echo get_dlink('http://www.megavideo.com/?v=17JIAQW9');
  102.  
  103. echo get_dlink('http://www.megavideo.com/v/17JIAQW97d2eb89ed9a082ebafdc64591627b648.5621461736.0');
  104. ?>


jednak wywala on taki błąd:

  1. Getting link for [url="http://www.megavideo.com/?v=17JIAQW9"]http://www.megavideo.com/?v=17JIAQW9[/url]
  2.  
  3. Warning: Missing argument 2 for get_dlink(), called in /var/www/gmvu.php on line 103 and defined in /var/www/gmvu.php on line 47
  4.  
  5. Warning: Missing argument 3 for get_dlink(), called in /var/www/gmvu.php on line 103 and defined in /var/www/gmvu.php on line 47
  6.  
  7. Warning: Missing argument 4 for get_dlink(), called in /var/www/gmvu.php on line 103 and defined in /var/www/gmvu.php on line 47
  8. Getting link for [url="http://www.megavideo.com/v/17JIAQW97d2eb89ed9a082ebafdc64591627b648.5621461736.0"]http://www.megavideo.com/v/17JIAQW97d2eb89...48.5621461736.0[/url]
  9.  
  10. Warning: Missing argument 2 for get_dlink(), called in /var/www/gmvu.php on line 106 and defined in /var/www/gmvu.php on line 47
  11.  
  12. Warning: Missing argument 3 for get_dlink(), called in /var/www/gmvu.php on line 106 and defined in /var/www/gmvu.php on line 47
  13.  
  14. Warning: Missing argument 4 for get_dlink(), called in /var/www/gmvu.php on line 106 and defined in /var/www/gmvu.php on line 47


W czym może być problem? Pozdrawiam.
Wicepsik
funkcja get_dlink zawiera 4 parametry, ty wpisałeś 1
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.