Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Skrypt do DotPay
servs
post
Post #1





Grupa: Zarejestrowani
Postów: 235
Pomógł: 0
Dołączył: 18.11.2006
Skąd: gorzów

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


Cześć,

Wymodziłem coś takiego:

  1. $server = 'ssl.dotpay.pl';
  2.  
  3. $parameters = "id=12345&kwota=10.53&waluta=PLN&opis=Klucz 45634&lang=pl";
  4. $fsocket = false;
  5. $curl = false;
  6. $result = false;
  7.  
  8. if ( (PHP_VERSION >= 4.3) && ($fp = @fsockopen('ssl://' . $server, 443, $errno, $errstr, 30)) ) {
  9. $fsocket = true;
  10. } elseif (function_exists('curl_exec')) {
  11. $curl = true;
  12. }
  13.  
  14. if ($fsocket == true) {
  15. $header = 'POST HTTP/1.0' . "\r\n" .
  16. 'Host: ' . $server . "\r\n" .
  17. 'Content-Type: application/x-www-form-urlencoded' . "\r\n" .
  18. 'Content-Length: ' . strlen($parameters) . "\r\n" .
  19. 'Connection: close' . "\r\n\r\n";
  20. @fputs($fp, $header . $parameters);
  21. $platnosci_response = '';
  22. while (!@feof($fp)) {
  23. $res = @fgets($fp, 1024);
  24. $platnosci_response .= $res;
  25. }
  26. @fclose($fp);
  27.  
  28. } elseif ($curl == true) {
  29. $ch = curl_init();
  30. curl_setopt($ch, CURLOPT_URL, "https://" . $server);
  31. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  32. curl_setopt($ch, CURLOPT_HEADER, 0);
  33. curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  34. curl_setopt($ch, CURLOPT_POST, 1);
  35. curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
  36. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  37. $platnosci_response = curl_exec($ch);
  38. curl_close($ch);
  39. } else {
  40. die("ERROR: No connect method ...\n");
  41. }


Niestety pomimo tego, że działało mi to z platnosci.pl, to nie chce działać z DotPay. Po prostu wyświetla pustą stronę i koniec. A powinien być wybór metody płatności.

Jakby ktoś rzucił na to okiem i coś podpowiedział, to będę wdzięczny.

Pozdrawiam,
Bartek.

Ten post edytował servs 19.01.2012, 18:24:26
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: 16.09.2025 - 20:47