Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form name=form id=form method=POST action="login.php">
- <input type=text name=user id=user value="">
- <input type=password name=pass id=pass>
- <input type=submit value="OK" id=sendButton name="sendButton">
- <input type=hidden name=pass2>
- <input type=hidden name=token value="7b8b7d712273aa254e03ea04a30322ab">
- </form>
- user=test&pass=&login=OK&pass2=7c7e36071354b4ecde365b315ffa4406&token=
- $url = 'http://www.myurl.com/login.php';
- $ch = curl_init();
- curl_setopt ($ch, CURLOPT_URL, $url);
- curl_setopt ($ch, CURLOPT_REFERER, $url);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- $content = curl_exec($ch);
- $doc = new DOMDocument();
- $doc->loadHTML($content);
- $tags = $doc->getElementsByTagName('input');
- foreach ($tags as $tag) {
- if($tag->getAttribute('name') === 'token') {
- $token = $tag->getAttribute('value');
- }
- }
- foreach ($tags as $tag) {
- if($tag->getAttribute('name') === 'pass2') {
- $pass2 = $tag->getAttribute('value');
- }
- }
- $com = 'OK';
- $postdata = 'user='.$user.'&pass='.$pass.'&sendButton='.$com.'&pass2='.$pass2.'&token='.$token;
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
- curl_setopt ($ch, CURLOPT_POST, 1);
- $result = curl_exec ($ch);
- echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement