Exemplo n.º 1
0
for (;;) {
    $time = date("Hi");
    $sql = mysqli_query($connect, "select * from wx_article where `state`= 0 and `ntime`<={$time} and CAST(`ntime`/100 AS SIGNED)-CAST(`gtime`/100 AS SIGNED) <= `days`*24 order by ctime desc");
    while ($re_row = mysqli_fetch_array($sql)) {
        $keysql = mysqli_query($connect, "select * from wx_keys order by ctime desc");
        $key = mysqli_fetch_row($keysql);
        if (time() - $key[2] > 7200) {
            break;
        }
        if ($re_row) {
            if ($re_row['ntime'] > 2400) {
                $ntime = 0 + $re_row['numbers'] * 100;
            } else {
                $ntime = $re_row['ntime'] + $re_row['numbers'] * 100;
            }
            $wz = get_read($re_row['wzurl'], $key[1]);
            mysqli_query($connect, "UPDATE wx_article SET `wzreads`='{$wz['read']}',`wzsuports`='{$wz['suport']}' where id = {$re_row['id']}");
            mysqli_query($connect, "UPDATE `wx_reads`.`wx_article` SET `ntime`='{$ntime}' WHERE (`id`='{$re_row['id']}');");
            sleep(3);
        }
    }
    sleep(1);
}
function get_read($url = '', $key, $uid = 1)
{
    $wzurl = "{$url}&key={$key}&ascene=1&uin=Nzc5OTI2MTIx&pass_ticket=kzTtalLseTrEcwKVHswOVecGMByySYu94gRKdAXokFv2jg4UAOt%2FkrZHb0IwUlSB";
    $bsurl = "http://mp.weixin.qq.com/s?{$url}";
    require_once "Snoopy.class.php";
    $snoopy = new Snoopy();
    $snoopy->agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16";
    //伪装浏览器
Exemplo n.º 2
0
<head>
<meta charset="utf-8">
<title>微信阅读数采集</title>
</head>

<body>
<form action="" method="post">
  文章url前缀<input type="text" name="wzurl">
  微信key<input type="text" name="key">
  <input type="submit" name="tijiao" value="提交">
</form>
<?php 
if ($_POST['tijiao']) {
    $wzurl = $_POST['wzurl'];
    $key = $_POST['key'];
    get_read($wzurl, $key);
    mysqli_close($connect);
    header("Location: http://localhost/wx_read.php");
}
function get_read($url = '', $key, $uid = 1)
{
    $wzurl = "http://mp.weixin.qq.com/s?{$url}&key={$key}&ascene=1&uin=Nzc5OTI2MTIx&pass_ticket=kzTtalLseTrEcwKVHswOVecGMByySYu94gRKdAXokFv2jg4UAOt%2FkrZHb0IwUlSB";
    $bsurl = "http://mp.weixin.qq.com/s?{$url}";
    require_once "Snoopy.class.php";
    $snoopy = new Snoopy();
    $snoopy->agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16";
    //伪装浏览器
    $snoopy->fetch($wzurl);
    //获取所有内容
    $content = $snoopy->results;
    //显示结果