Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] uploader na megavideo - nie dziala..
Forum PHP.pl > Forum > Przedszkole
chez
witam,
próbuję napisać w PHP uploader który będzie wrzucał mi filmy z dysku (Linux) na megavideo, ale cos nie wychodzi :/
moze ktos pomoze? o to co juz napisalem:

  1. <?php
  2.        $COOKIE_FILE = '/tmp/cookie.txt';
  3.        $url = 'http://megavideo.com/?s=signup';
  4.        $ch = curl_init();
  5.        curl_setopt($ch, CURLOPT_URL,$url);
  6.        curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  7.        curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  8.        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  9.        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  10.        curl_setopt($ch, CURLOPT_TIMEOUT, 50);
  11.        curl_setopt($ch, CURLOPT_POST, 1);
  12.        curl_setopt($ch, CURLOPT_POSTFIELDS, 'action=login&cnext=&snext=&touser=&user=&nickname=LOGIN&password=HASLO');
  13.        $buffer = curl_exec($ch);
  14.        curl_close($ch);
  15.        echo $buffer;
  16.  
  17.        $url = 'http://megavideo.com/?c=upload';
  18.        $ch = curl_init();
  19.        curl_setopt($ch, CURLOPT_URL,$url);
  20.        curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  21.        curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  22.        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  23.        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  24.        curl_setopt($ch, CURLOPT_TIMEOUT, 50);        
  25.        curl_setopt($ch, CURLOPT_POST, 1);
  26.        curl_setopt($ch, CURLOPT_POSTFIELDS, 'action=step2&title=tytul&description=opis&tags=tagi&language=1&channel=23');
  27.        $buffer = curl_exec($ch);
  28.        curl_close($ch);
  29.        //echo $buffer;
  30.  
  31.        $url = 'http://www130.megavideo.com/upload_video.php';
  32.        $ch = curl_init();
  33.        curl_setopt($ch, CURLOPT_URL,$url);
  34.        curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  35.        curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  36.        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  37.        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  38.        curl_setopt($ch, CURLOPT_TIMEOUT, 50);        
  39.        curl_setopt($ch, CURLOPT_POST, 1);
  40.        curl_setopt($ch, CURLOPT_POSTFIELDS, '-----------------------------25542761920913r\n
  41. Content-Disposition: form-data; name="action"r\n
  42. r\n
  43. submitr\n
  44. -----------------------------25542761920913r\n
  45. Content-Disposition: form-data; name="tags"r\n
  46. r\n
  47. tagir\n
  48. -----------------------------25542761920913r\n
  49. Content-Disposition: form-data; name="title"r\n
  50. r\n
  51. tytulr\n
  52. -----------------------------25542761920913r\n
  53. Content-Disposition: form-data; name="language"r\n
  54. r\n
  55. 1r\n
  56. -----------------------------25542761920913r\n
  57. Content-Disposition: form-data; name="message"r\n
  58. r\n
  59. opisr\n
  60. -----------------------------25542761920913r\n
  61. Content-Disposition: form-data; name="channels"r\n
  62. r\n
  63. 23;r\n
  64. -----------------------------25542761920913r\n
  65. Content-Disposition: form-data; name="file"; filename="August3i.avi"r\n
  66. Content-Type: video/x-msvideor\n
  67. r\n
  68. RIFFe:x02');
  69.        $buffer = curl_exec($ch);
  70.        curl_close($ch);
  71.        echo $buffer;
  72.  
  73.  
  74. ?>


Login i Hasło podałem dla tych którzy chcą mi pomóc, aby zaoszczędzić czas na rejestracji.
wookieb
Usuń ten login i hasło.
http://pl.php.net/manual/en/function.curl-setopt.php
Cytat
To post a file, prepend a filename with @ and use the full path.


  1. <?php
  2. curl_setopt($ch, CURLOPT_POSTFIELDS,array('file'=>'@August3i.avi'));
  3. ?>

Oczywiscie tablice musisz uaktualnic o dodatkowe swoje dane.
pyro
Cytat(wookieb @ 17.07.2009, 14:47:32 ) *
Usuń ten login i hasło.
http://pl.php.net/manual/en/function.curl-setopt.php


  1. <?php
  2. curl_setopt($ch, CURLOPT_POSTFIELDS,array('file'=>'@August3i.avi'));
  3. ?>

Oczywiscie tablice musisz uaktualnic o dodatkowe swoje dane.


@wookieb, czytaj też co kopiujesz tongue.gif

Cytat
prepend a filename with @ and use the full path.
chez
no i dalej cos nie wrzuca..
pyro
Cytat(chez @ 17.07.2009, 14:57:24 ) *
no i dalej cos nie wrzuca..


no i dalej poprawionego kodu nie widać..
chez
sorki zapomnailem
  1. <?php
  2. $COOKIE_FILE = '/var/www/web9/html/templates_c/cookie.txt';
  3.  
  4.  
  5.        $url = 'http://megavideo.com/?s=signup';
  6.        $ch = curl_init();
  7.        curl_setopt($ch, CURLOPT_URL,$url);
  8.        curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  9.        curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  10.        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  11.        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  12.        curl_setopt($ch, CURLOPT_TIMEOUT, 50);
  13.        curl_setopt($ch, CURLOPT_POST, 1);
  14.        curl_setopt($ch, CURLOPT_POSTFIELDS, 'action=login&cnext=&snext=&touser=&user=&nickname=chezpl&password=qwe123');
  15.        $buffer = curl_exec($ch);
  16.        curl_close($ch);
  17.        echo $buffer;
  18.    
  19.    
  20.    
  21.    
  22.    
  23.    
  24.        $url = 'http://megavideo.com/?c=upload';
  25.        $ch = curl_init();
  26.        curl_setopt($ch, CURLOPT_URL,$url);
  27.        curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  28.        curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  29.        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  30.        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  31.        curl_setopt($ch, CURLOPT_TIMEOUT, 50);        
  32.        curl_setopt($ch, CURLOPT_POST, 1);
  33.        curl_setopt($ch, CURLOPT_POSTFIELDS, 'action=step2&title=tytul&description=opis&tags=tagi&language=1&channel=23');
  34.        $buffer = curl_exec($ch);
  35.        curl_close($ch);
  36.        //echo $buffer;
  37.        
  38.        
  39.        $url = 'http://www130.megavideo.com/upload_video.php';
  40.  
  41. $data = array('action' => 'submit', 'file' => '@/var/www/web9/html/templates_c/August3i.avi', 'tags' => 'tagi', 'title' => 'tytul', 'language' => '1', 'message' => 'opis', 'channels' => '23' );
  42.  
  43.  
  44.        $ch = curl_init();
  45.        curl_setopt($ch, CURLOPT_URL,$url);
  46.        curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
  47.        curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
  48.        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  49.        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  50.        curl_setopt($ch, CURLOPT_TIMEOUT, 50);        
  51.        curl_setopt($ch, CURLOPT_POST, 1);
  52.        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  53.        $buffer = curl_exec($ch);
  54.        curl_close($ch);
  55.        echo $buffer;
  56.  
  57. ?>


odswiezam

nikt nie wie co jest nie tak ?
erix
A chociaż cokolwiek zwraca...?
chez
właśnie nie
erix
Nie masz błędów składni? A nuż serwis jest przed czymś takim zabezpieczony?
chez
wlasnie zero bledow... raczej nie jest zabezpieczony przynajmniej nie widze, moglbys sprawdzic ?

odswiezam
bartek24m
również proszę o pomoc w napisaniu takiego skryptu
mogę nawet zapłacić

Pozdr.
b4x
Zobacz moją prostą klasę: nMegaVideo.

* Sory, że "podbijam temat" - w miarę stary ;-) - ale może komuś się przyda.
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.