Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> bot rapidshare - curl, exec
marcinpruciak
post
Post #1





Grupa: Zarejestrowani
Postów: 161
Pomógł: 9
Dołączył: 14.07.2008

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


Mam taki problem z skryptem. Jest to bot do rapidshare, generuje on directlink do pobierania i wywołuje wgeta do pobrania go. Z tym właśnie jest problem, zamiast pobierać się zawartość pobiera się tylko strona z błędem. Jeśli uruchomię ręcznie wgeta z tym wygenerowanym linkiem w konsoli, to działa i odrazu się pobiera. 

Ma ktoś jakiś pomysł?

Załączam kod:

  1. <?
  2. function get_content($url)
  3. {
  4.     $ch = curl_init();
  5.  
  6.     curl_setopt ($ch, CURLOPT_URL, $url);
  7.     curl_setopt ($ch, CURLOPT_HEADER, 0);
  8.  
  9.     ob_start();
  10.  
  11.     curl_exec ($ch);
  12.     curl_close ($ch);
  13.     $string = ob_get_contents();
  14.  
  15.     ob_end_clean();
  16.     
  17.  return $string;     
  18. }
  19.  
  20. $content = get_content ("htt://rapidshare.com/files/32805773/test.avi.html");
  21. $action = preg_match('<form action="(.+?)" method="post">', $content, $matches);
  22. $matches = $matches[0];
  23. $action = substr($matches, 13, -15);
  24.  
  25.  $curl = curl_init($action);
  26.      curl_setopt($curl, CURLOPT_FAILONERROR, 1);
  27.      curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  28.      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  29.      curl_setopt($curl, CURLOPT_TIMEOUT, 50);
  30.      curl_setopt($curl, CURLOPT_POST, 1);
  31.      curl_setopt($curl, CURLOPT_POSTFIELDS, 'dl.start=Free');
  32.      $r = curl_exec($curl);
  33.      curl_close($curl);
  34.  
  35.      $x = preg_match('<form name="dlf" action="(.+?)" method="post">', $r, $link);
  36.      $link = substr($link[0], 24, -15);
  37.  
  38.  echo $link;
  39.  sleep('50');
  40.  $komenda = "wget $link";
  41.  exec($komenda);
  42. ?>


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 20.08.2025 - 19:04