Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Curl mintshost lub biznes-host
MateuszCODE
post 26.05.2016, 14:43:48
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 26.05.2016

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


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. ?>
Go to the top of the page
+Quote Post
SHiP
post 27.05.2016, 08:42:17
Post #2





Grupa: Zarejestrowani
Postów: 697
Pomógł: 47
Dołączył: 19.12.2003
Skąd: Lublin

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


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'));




--------------------
Warsztat: Kubuntu, PhpStorm, Opera
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: 4.06.2024 - 23:27