Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Token jak pobrac?
matx132
post 26.08.2008, 12:29:59
Post #1





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


Witam,
probuję zrobić sobie skrypt downloadu z odsiebie.com.
lecz niestety mam problem z tokenem.
nie mogę Go wyświetlić w przeglądarce(nie chce aby był on analizowany lecz pobrany z serwisu).
Lecz tak jak to bywa niestety nie mogę próbowałem zrobić tak jak jest na stronie czyli
Kod
<img src="http://odsiebie.com/captcha.php">


ale pokazuje mi się obrazek bez liczb sad.gif
i teraz nie wiem jak to mogę zrobić czy mogłby ktos podac jakis skrypt lub powiedziec mniej wiecej jak to zrobić(chciałbym to sam zrobic)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
SirZooro
post 26.08.2008, 12:58:22
Post #2





Grupa: Zarejestrowani
Postów: 243
Pomógł: 32
Dołączył: 14.06.2007

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


Musisz napisać kawałek kodu który będzie utrzymywał sesję z tamtym serwerem. Inaczej mówiąc skrypt - proxy dla tego obrazka.


--------------------
Go to the top of the page
+Quote Post
matx132
post 26.08.2008, 13:31:03
Post #3





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


sprobowałem curl pobrac plik jpg
  1. <?php
  2. $ch = curl_init('http://odsiebie.com/captcha.php');
  3. $fh = fopen('plik.jpg', 'w');
  4. curl_setopt($ch, CURLOPT_FILE, $fh);
  5. curl_exec($ch);
  6. fclose($fh);
  7. curl_close($ch);
  8. ?>


plik się ładnie zapisuje ale nadal bez niczego
czy możecie mnie naprowadzić może jak zrobić to (tzn utrzymać sesję z serwera?)
w skrypcie
wchodze na link imituje naciśniecie przycisku i przechodze do weryfikacji
lecz po wyprintowaniu strony obrazek jest pusty:(

robię to tak

  1. <?php
  2. $Url=parse_url($url_action);
  3. $page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), 0, 0, 0, 0, $_GET["proxy"],$pauth);
  4.  
  5. is_page($page);
  6. ?>


a oto te dwie funkcje

  1. <?php
  2. function is_page($lpage)
  3. {
  4. global $lastError;
  5. if (!$lpage)
  6. {
  7. html_error("Error retriving the link<br>$lastError", 0);
  8. }
  9. }
  10.  
  11. function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveToFile = 0, $proxy = 0, $pauth = 0, $auth = 0, $scheme = "http", $resume_from = 0) {
  12. global $nn, $lastError, $PHP_SELF, $AUTH, $IS_FTP, $FtpBytesTotal, $FtpBytesReceived, $FtpTimeStart, $FtpChunkSize, $Resume, $bytesReceived, $fs, $forbidden_filetypes, $rename_these_filetypes_to, $bw_save, $force_name;
  13.  
  14. $scheme.= "://";
  15.  
  16. if (($post !== 0) && ($scheme == "http://"))
  17. {
  18. $method = "POST";
  19. $postdata = formpostdata($post);
  20. $length = strlen($postdata);
  21. $content_tl = "Content-Type: application/x-www-form-urlencoded".$nn."Content-Length: ".$length.$nn;
  22. }
  23. else
  24. {
  25. $method = "GET";
  26. $postdata = "";
  27. $content_tl = "";
  28. }
  29.  
  30. if ($cookie)
  31. {
  32. if (is_array($cookie))
  33. {
  34. for( $i = 0; $i < count($cookie); $i++)
  35. {
  36. $cookies .= "Cookie: ".$cookie[$i].$nn;
  37. }
  38. }
  39. else
  40. {
  41. $cookies = "Cookie: ".$cookie.$nn;
  42. }
  43. }
  44. $referer = $referer ? "Referer: ".$referer.$nn : "";
  45.  
  46. if ($scheme == "https://")
  47. {
  48. $scheme = "ssl://";
  49. $port = 443;
  50. }
  51.  
  52. if($proxy)
  53. {
  54. list($proxyHost, $proxyPort) = explode(":", $proxy);
  55. $url = $scheme.$host.":".$port.$url;
  56. $host = $host.":".$port;
  57. }
  58.  
  59. if ($scheme != "ssl://")
  60. {
  61. $scheme = "";
  62. }
  63.  
  64. $http_auth = ($auth) ? "Authorization: Basic ".$auth.$nn : "";
  65. $proxyauth = ($pauth) ? "Proxy-Authorization: Basic ".$pauth.$nn : "";
  66.  
  67. $request=
  68. $method." ".str_replace(" ", "%20", $url)." HTTP/1.1".$nn.
  69. "Host: ".$host.$nn.
  70. "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14".$nn.
  71. "Accept: */*".$nn.
  72. "Accept-Language: en-us;q=0.7,en;q=0.3".$nn.
  73. "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7".$nn.
  74. "Pragma: no-cache".$nn.
  75. "Cache-Control: no-chache".$nn.
  76. ($Resume["use"] === TRUE ? "Range: bytes=".$Resume["from"]."-".$nn : "").
  77. $http_auth.
  78. $proxyauth.
  79. $referer.
  80. $cookies.
  81. "Connection: Close".$nn.
  82. $content_tl.$nn.$postdata;
  83.  
  84. //write_file(CONFIG_DIR."request.txt", $request);
  85.  
  86. $fp = @fsockopen($proxyHost ? $scheme.$proxyHost : $scheme.$host, $proxyPort ? $proxyPort : $port, $errno, $errstr, 15);
  87. ?>
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: 14.08.2025 - 03:16