Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Curl mintshost lub biznes-host
Forum PHP.pl > Forum > PHP
MateuszCODE
Witam mam skrypt do transferu srodków ale on nie działa po update panelu
  1. <?php
  2.  
  3.  
  4. $link = "http://mintshost.pl/";
  5. $login = "twoj mail";
  6. $pass = "haslo";
  7. $kwota = 1;
  8. $odbiorca = "mail odbiorcy";
  9.  
  10. $cookieFile = 'cookies/' . uniqid(true) . '.txt';
  11.  
  12.  
  13.  
  14. /* NIE WIEM CZY TO ZADZIAŁA
  15.  
  16. $tags = $doc->getElementsByTagName('input');
  17.  
  18.  
  19. foreach ($tags as $tag) {
  20.   if($tag->getAttribute('name') === 'token') {
  21.   $token = $tag->getAttribute('value');
  22.   }
  23. }
  24. */
  25.  
  26.  
  27. // Login
  28. $curl = curl_init();
  29. curl_setopt($curl, CURLOPT_URL, $link.'clientarea.php');
  30. curl_setopt($curl, CURLOPT_COOKIEJAR, $cookieFile);
  31. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  32. curl_setopt($curl, CURLOPT_HEADER, true);
  33. curl_setopt($curl, CURLOPT_POST, true);
  34. $postVars = array('username' => $login, 'password' => $pass, 'token' => $token, '' => 'Zaloguj się');
  35. curl_setopt($curl, CURLOPT_POSTFIELDS, $postVars);
  36. $resp = curl_exec($curl);
  37. curl_close($curl);
  38.  
  39. // Parse sid from cookie file
  40. $match = explode('sid', file_get_contents($cookieFile));
  41. $sId = trim($match[1]);
  42.  
  43. // Post
  44. $curl = curl_init();
  45. $temat1 = "$link.'transfer_srodkow.php";
  46. curl_setopt($curl, CURLOPT_URL, $link);
  47. curl_setopt($curl, CURLOPT_COOKIEFILE, $cookieFile);
  48. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  49. curl_setopt($curl, CURLOPT_HEADER, false);
  50. curl_setopt($curl, CURLOPT_POST, true);
  51. $postVars = array('kwota' => $kwota,
  52. 'email_2' => $odbiorca,
  53. 'token' => $token,
  54. '' => 'Przelej');
  55. curl_setopt($curl, CURLOPT_POSTFIELDS, $postVars);
  56. $result = curl_exec($curl);
  57. curl_close($curl);
  58.  
  59. $pattern = '#<a href="(.*?)">Tutaj</a>#';
  60. $ile = preg_match_all($pattern, $result, $matches, PREG_PATTERN_ORDER);
  61. //print_r($matches);
  62. //echo $matches[1][0];
  63. $zwrot = $link . $matches[1][0];
  64. echo "$i. $zwrot <br>";
  65. //echo $resp;
  66.  
  67.  
  68.  
  69. ?>
SHiP
Polecam włączenie opcji verbose i sprawdzenie jakie błędy wyrzuca curl.

  1. curl_setopt($curl, CURLOPT_VERBOSE, true);
  2. curl_setopt($curl, CURLOPT_STDERR, fopen('php://stderr', 'w'));


To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.