Advertisement
Guest User

Untitled

a guest
Nov 30th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <form name=form id=form method=POST action="login.php">
  2. <input type=text name=user id=user value="">
  3. <input type=password name=pass id=pass>
  4. <input type=submit value="OK" id=sendButton name="sendButton">
  5. <input type=hidden name=pass2>
  6. <input type=hidden name=token value="7b8b7d712273aa254e03ea04a30322ab">
  7. </form>
  8.  
  9. user=test&pass=&login=OK&pass2=7c7e36071354b4ecde365b315ffa4406&token=
  10.  
  11. $url = 'http://www.myurl.com/login.php';
  12.  
  13. $ch = curl_init();
  14.  
  15. curl_setopt ($ch, CURLOPT_URL, $url);
  16. curl_setopt ($ch, CURLOPT_REFERER, $url);
  17. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  18. curl_setopt($ch, CURLOPT_HEADER, 0);
  19.  
  20. $content = curl_exec($ch);
  21.  
  22. $doc = new DOMDocument();
  23. $doc->loadHTML($content);
  24.  
  25. $tags = $doc->getElementsByTagName('input');
  26.  
  27. foreach ($tags as $tag) {
  28. if($tag->getAttribute('name') === 'token') {
  29. $token = $tag->getAttribute('value');
  30. }
  31. }
  32.  
  33. foreach ($tags as $tag) {
  34. if($tag->getAttribute('name') === 'pass2') {
  35. $pass2 = $tag->getAttribute('value');
  36. }
  37. }
  38.  
  39. $com = 'OK';
  40. $postdata = 'user='.$user.'&pass='.$pass.'&sendButton='.$com.'&pass2='.$pass2.'&token='.$token;
  41.  
  42. curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
  43. curl_setopt ($ch, CURLOPT_POST, 1);
  44. $result = curl_exec ($ch);
  45.  
  46. echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement