Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] uploader na megavideo - nie dziala..
chez
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 2.06.2008

Ostrzeżenie: (0%)
-----


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.
Powód edycji: [erix] skasowałem dane dostępowe
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 11)
wookieb
post
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




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.

Ten post edytował wookieb 17.07.2009, 13:48:40
Go to the top of the page
+Quote Post
pyro
post
Post #3





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


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 (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)

Cytat
prepend a filename with @ and use the full path.
Go to the top of the page
+Quote Post
chez
post
Post #4





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 2.06.2008

Ostrzeżenie: (0%)
-----


no i dalej cos nie wrzuca..
Go to the top of the page
+Quote Post
pyro
post
Post #5





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


Cytat(chez @ 17.07.2009, 14:57:24 ) *
no i dalej cos nie wrzuca..


no i dalej poprawionego kodu nie widać..
Go to the top of the page
+Quote Post
chez
post
Post #6





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 2.06.2008

Ostrzeżenie: (0%)
-----


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 ?
Go to the top of the page
+Quote Post
erix
post
Post #7





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




A chociaż cokolwiek zwraca...?
Go to the top of the page
+Quote Post
chez
post
Post #8





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 2.06.2008

Ostrzeżenie: (0%)
-----


właśnie nie
Go to the top of the page
+Quote Post
erix
post
Post #9





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Nie masz błędów składni? A nuż serwis jest przed czymś takim zabezpieczony?
Go to the top of the page
+Quote Post
chez
post
Post #10





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 2.06.2008

Ostrzeżenie: (0%)
-----


wlasnie zero bledow... raczej nie jest zabezpieczony przynajmniej nie widze, moglbys sprawdzic ?

odswiezam
Go to the top of the page
+Quote Post
bartek24m
post
Post #11





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 17.06.2006

Ostrzeżenie: (0%)
-----


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

Pozdr.

Ten post edytował bartek24m 4.08.2009, 09:10:36
Go to the top of the page
+Quote Post
b4x
post
Post #12





Grupa: Zarejestrowani
Postów: 658
Pomógł: 95
Dołączył: 20.12.2005
Skąd: N54,35° E18,63° (Gdańsk)

Ostrzeżenie: (0%)
-----


Zobacz moją prostą klasę: nMegaVideo.

* Sory, że "podbijam temat" - w miarę stary ;-) - ale może komuś się przyda.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 18.09.2025 - 16:13