Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Protokół http
Krisu
post 22.05.2008, 19:46:33
Post #1





Grupa: Zarejestrowani
Postów: 211
Pomógł: 0
Dołączył: 30.03.2006
Skąd: Żary

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


  1. <?php
  2.  
  3. function imageshackUpload($filename){
  4. $sock = @fsockopen("www.bankfotek.pl", 80, $errno, $errstr, 30);
  5.  
  6. $handle = fopen($filename, "r");
  7. $binarydata = fread($handle, filesize($filename));
  8. fclose($handle);
  9.  
  10. $mimetype = 'image/png';
  11.  
  12. $AaB03x = "--AaB03xr\n";
  13. $AaB03x .="content-disposition: form-data; name=\"uploadtype\"r\nr\n";
  14.  
  15. $AaB03x .= "onr\n";
  16. $AaB03x .= "--AaB03xr\n";
  17.  
  18. // nazwa pliku file
  19. $AaB03x .= "content-disposition: form-data; name=\"imagefile\"; filename=\"".basename($filename)."\"r\n";
  20. // koniec pliku file
  21.  
  22. $AaB03x .= "Content-Type: $mimetyper\n";
  23. $AaB03x .= "Content-Transfer-Encoding: binaryr\nr\n";
  24.  
  25. $AaB03x .= "$binarydatar\n";
  26. $AaB03x .= "--AaB03x--r\n";
  27.  
  28. $header = "POST / HTTP/1.1r\n";
  29. $header .= "Host: www.bankfotek.pl/process.phpr\n";
  30. $header .= "Content-type: multipart/form-data, boundary=AaB03xr\n";
  31. $header .= "Content-Length: ".strlen($AaB03x)."r\nr\n";
  32.  
  33. $header .= $AaB03x;
  34.  
  35. fwrite($sock, $header);
  36.  
  37. while (!feof($sock)) { $response .= fgets($sock, 128); }
  38.  
  39. fclose($sock);
  40.  
  41. preg_match("/BankFotek.pl ([^>]*) zdjęcia/si", $response, $matches);
  42.  
  43. return $matches[0];
  44. }
  45.  
  46. ?>


Skrypt przesyła obrazek na serwer bankfotek.pl i do tego momentu wszystko działa. Jednak nie mogę sobie poradzić z odczytem linka ze źródła strony. Cały problem polega na tym, że po przesłaniu obrazka, wszystkie informacje na jego temat (wraz z linkami) pojawiają się na stronie www.bankfotek.pl/process.php

Teraz pytanie jak mogę odczytać linka z tej strony?
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 Wersja Lo-Fi Aktualny czas: 18.07.2025 - 13:15