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
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

Posty w temacie


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: 12.10.2025 - 04:33