Advertisement
Guest User

grab my site

a guest
May 5th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. <?php
  2.  
  3. //Upload a blank cookies.txt to the same directory as this file with a CHMOD/Permission to 777
  4. function login($url,$data){
  5. $fp = fopen("cookies.txt", "w");
  6. fclose($fp);
  7. $login = curl_init();
  8. curl_setopt($login, CURLOPT_COOKIEJAR, "cookies.txt");
  9. curl_setopt($login, CURLOPT_COOKIEFILE, "cookies.txt");
  10. curl_setopt($login, CURLOPT_TIMEOUT, 40000);
  11. curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE);
  12. curl_setopt($login, CURLOPT_URL, $url);
  13. curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  14. curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE);
  15. curl_setopt($login, CURLOPT_POST, TRUE);
  16. curl_setopt($login, CURLOPT_POSTFIELDS, $data);
  17. ob_start();
  18. return curl_exec ($login);
  19. ob_end_clean();
  20. curl_close ($login);
  21. unset($login);
  22. }
  23.  
  24. function grab_page($site){
  25. $ch = curl_init();
  26. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  27. curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  28. curl_setopt($ch, CURLOPT_TIMEOUT, 40);
  29. curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
  30. curl_setopt($ch, CURLOPT_URL, $site);
  31. ob_start();
  32. return curl_exec ($ch);
  33. ob_end_clean();
  34. curl_close ($ch);
  35. }
  36.  
  37. function post_data($site,$data){
  38. $datapost = curl_init();
  39. $headers = array("Expect:");
  40. curl_setopt($datapost, CURLOPT_URL, $site);
  41. curl_setopt($datapost, CURLOPT_TIMEOUT, 40000);
  42. curl_setopt($datapost, CURLOPT_HEADER, TRUE);
  43. curl_setopt($datapost, CURLOPT_HTTPHEADER, $headers);
  44. curl_setopt($datapost, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  45. curl_setopt($datapost, CURLOPT_POST, TRUE);
  46. curl_setopt($datapost, CURLOPT_POSTFIELDS, $data);
  47. curl_setopt($datapost, CURLOPT_COOKIEFILE, "cookies.txt");
  48. ob_start();
  49. return curl_exec ($datapost);
  50. ob_end_clean();
  51. curl_close ($datapost);
  52. unset($datapost);
  53. }
  54.  
  55. ?>
  56.  
  57.  
  58. <?php
  59.  
  60. login("https://ib.bankmandiri.co.id/retail/Login.do","action=result&userID=xxxxxx&password=xxxxxxx");
  61.  
  62. echo grab_page("https://ib.bankmandiri.co.id/retail/Redirect.do?action=forward");
  63.  
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement