Advertisement
Guest User

Untitled

a guest
Jan 31st, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4.  
  5. require('simple_html_dom.php');
  6. //username and password of account
  7. $username = htmlspecialchars($_SESSION['email']);
  8. $password = htmlspecialchars($_SESSION['password']);
  9. $url = "https://wallet.gelredome.nl/nl/login";
  10.  
  11. $ch = curl_init();
  12. curl_setopt($ch, CURLOPT_URL, $url);
  13. curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107 Chrome/32.0.1700.107 Safari/537.36');
  14. curl_setopt($ch, CURLOPT_POST, true);
  15. curl_setopt($ch, CURLOPT_POSTFIELDS, "Email=$username&Password=$password");
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  17. curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  18. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie-name'); //could be empty, but cause problems on some hosts
  19. curl_setopt($ch, CURLOPT_COOKIEFILE, '/var/www/ip4.x/file/tmp'); //could be empty, but cause problems on some hosts
  20. $answer = curl_exec($ch);
  21. if (curl_error($ch)) {
  22. echo curl_error($ch);
  23. }
  24. //another request preserving the session
  25. curl_setopt($ch, CURLOPT_URL, 'https://wallet.gelredome.nl/nl/');
  26. curl_setopt($ch, CURLOPT_POST, false);
  27. curl_setopt($ch, CURLOPT_POSTFIELDS, "");
  28. $answer = curl_exec($ch);
  29. if (curl_error($ch)) {
  30. echo curl_error($ch);
  31. die;
  32. }
  33. $html = new simple_html_dom();
  34. $html->load($answer);
  35. $amount = $html->find('span.c-wallet-banner__currency-amount', 0);
  36. $symbols = array('$', '€', '£');
  37. //echo "&euro;"; //if you want to display Euro sign, just uncomment
  38. if($amount == ""){
  39. session_destroy();
  40.  
  41. die;
  42. }
  43. echo str_replace($symbols, '', $amount->innertext);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement