Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL, 'http://clean-machine.com.au/login.php');
  4. 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');
  5. curl_setopt($ch, CURLOPT_POST, true);
  6. curl_setopt($ch, CURLOPT_POSTFIELDS, "xid_59e5f=aa703d64fe1c8fb62efe0029daa878f9&is_remember=Y&mode=login&username=dipacci&password=dipacci");
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  8. curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  9. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie-name'); //could be empty, but cause problems on some hosts
  10. curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt'); //could be empty, but cause problems on some hosts
  11. $answer = curl_exec($ch);
  12.  
  13. if (curl_error($ch)) {
  14. echo curl_error($ch);
  15. }
  16.  
  17. //another request preserving the session
  18.  
  19. curl_setopt($ch, CURLOPT_URL, 'http://clean-machine.com.au/home.php');
  20. curl_setopt($ch, CURLOPT_POST, false);
  21. curl_setopt($ch, CURLOPT_POSTFIELDS, "");
  22. $answer = curl_exec($ch);
  23.  
  24. echo $answer;
  25. if (curl_error($ch)) {
  26. echo curl_error($ch);
  27. }
  28.  
  29.  
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement