Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> megaupload, ocr, wget, error 503
dtb
post 15.11.2006, 18:40:17
Post #1





Grupa: Zarejestrowani
Postów: 476
Pomógł: 1
Dołączył: 5.11.2005
Skąd: Bieruń city

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


mam kod wlasnej roboty, ktory automatycznie pobiera token z megaupload, rozpoznaje tekst, pobiera link i zaczyna sciagac plik. z tym ostatnim jest jednak problem. wget drukuje ze jest blad serwera 503: Service temporarily unavailable. Czy ktos umial by podsunac pomysl jak rozwiazac problem?

  1. <?php
  2. function post($host,$query,$others=''){
  3.  $path=explode('/',$host);
  4.  $host=$path[0];
  5.  unset($path[0]);
  6.  $path='/'.(implode('/',$path));
  7.  $post="POST $path HTTP/1.1rnHost: $hostrnContent-type: application/x-www-form-urlencodedrn${others}User-Agent: Mozilla4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; MEGAUPLOAD 1.
    0)rnContent-length: "
    .strlen($query)."rnConnection: Keep-Alivernrn$query";
  8. echo ">> wysylanie zapytaniarn";
  9.  $h=fsockopen($host,80);
  10.  fwrite($h,$post);
  11. echo "<< pobieranie stronyrn";
  12.  for($a=0,$r='';!$a;){
  13.  $b=fread($h,8192);
  14.  $r.=$b;
  15.  $a=(($b=='')?1:0);
  16.  }
  17.  fclose($h);
  18.  return $r;
  19. }
  20.  
  21. $return = post('www.megaupload.com/pl/', 'd=R8X4ZKP0');
  22. preg_match('/name="d" value="([a-zA-Z0-9]+)"/', $return, $d);
  23. preg_match('/name="imagecode" value="([a-zA-Z0-9]+)"/', $return, $imagecode);
  24. preg_match('/name="megavar" value="([a-zA-Z0-9]+)"/', $return, $megavar);
  25. preg_match('/<img src="/capgen.php?([a-zA-Z0-9]+)">/', $return, $match);
  26. print_r($match[0]);
  27. echo "<< pobieranie obrazkarn";
  28. $url = 'http://www.megaupload.com/pl/capgen.php?'.$match[1];
  29. system('wget -O temp.gif '.$url);
  30. system('giftopnm temp.gif > temp.pnm');
  31. system('gocr temp.pnm > temp.txt');
  32. $ocr = trim(file_get_contents('temp.txt'));
  33.  
  34. if (preg_match('/([A-Za-z]+){3,3}/', $ocr)) {
  35. echo ":: obrazek pobrany, a przeczytany tekst wydaje sie byc prawidlowyrn";
  36. } else {
  37. echo ":: obrazek pobrany, lecz nie udalo sie odczytac teksturn";
  38. }
  39.  
  40. $return = post('www.megaupload.com/pl/', 'd='.$d[1].'&imagecode='.$imagecode[1].'&megavar='.$megavar[1].'&imagestring='.$ocr.'');
  41. $return = str_replace(''', '"', $return);
  42.  
  43. var_dump(preg_match('/String.fromCharCode(Math.abs(([^)]+)));/', $return, $abs));
  44. var_dump(preg_match('/([A-Za-z0-9]+)" + String.fromCharCode(Math.sqrt(([^)]+)));/', $return, $sqrt));
  45. var_dump(preg_match(
  46. '/<a href="([^"]+)" + ([a-z]) + ([a-z]) + "([^"]+)" class="downloadhtml"/'
  47. , $return, $link));
  48.  
  49. //echo $abs[1].' '.$sqrt[1].' '.$sqrt[2].' '.$link[1].' '.$link[4];
  50. //print_r($link);
  51.  
  52. $url = $link[1].chr(abs($abs[1])).$sqrt[1].chr(sqrt($sqrt[2])).$link[4];
  53.  
  54. system('wget '.$url);
  55. ?>


--------------------
Go to the top of the page
+Quote Post
Sh4dow
post 16.11.2006, 11:47:02
Post #2





Grupa: Zarejestrowani
Postów: 569
Pomógł: 0
Dołączył: 17.08.2003
Skąd: Dąbrowa Górnicza

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


503: Service temporarily unavailable oznacza blad servera a nie blad twojej aplikacji. Wiec sprawdz dlaczego server ci to zwraca, moze masz zly url, moze server jest zabezpieczony jakos.


--------------------
Warsztat: Linux: PHP, MySQL, Apache, NetBeans, C++, Qt-Creator
Użytkownik, słowo którego specjaliści IT używają, gdy chcą powiedzieć idiota
Zarządzaj swoim budżetem domowym
Go to the top of the page
+Quote Post
dtb
post 16.11.2006, 22:39:44
Post #3





Grupa: Zarejestrowani
Postów: 476
Pomógł: 1
Dołączył: 5.11.2005
Skąd: Bieruń city

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


ze 503 to blad serwera to wiem. dokladnie przeanalizowalem kod megauploada i wiem, ze moj link jest dobry. zly musi byc sposob w jaki pobieram. moze sesje? nie mam pojecia.


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

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 Wersja Lo-Fi Aktualny czas: 5.07.2025 - 08:32