Sina blog forward crawl

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body style="background-color: gray;">
    <div class="container">
    
        <form method="get">

        <h4>Your cookie:< /h4>< textarea name= "cookie"class="form-control" rows="3" placeholder="Your cookie will be pasted in the debug, "> < /textarea>".< h4> a micro-blog id:< /h4>< inputName= "Id" type= "number"class="form-control" placeholder="Point out a string of numbers in the address bar of micro-blog: ">";< h4> function: < /h4>< selectclass="form-control" name="scene">
              <option value="Forwarding ">"; forwarding < /option>< /select>< h4> how many times: < /h4>< selectclass="form-control" name="count">
              <option value="100">10</option>
              <option value="100">100</option>
              <option value="500">500</option>
              <option value="1000">1000</option>
              <option value="5000">5000</option>
              <option value="10000">10000</option>
            </select>

            <button style="margin-top: 50px;width: 100%;" class="btn btn-default" type="submit">GOGOGO</button>
        </form>
   </div>   
</body>
</html>




<?php
/*header("Content-type: text/html; charset=utf-8");*/
ignore_user_abort(); //Turn off the browser, and the PHP script can continue.
set_time_limit(0); // Through set_time_limit (0), the program can be executed indefinitely.




if(!isset($_GET['cookie'])||!isset($_GET['count'])||!isset($_GET['id'])){
    return;
}

if($_GET['cookie']==''||$_GET['count']==''||$_GET['id']==''){
    echo '<h1>Incomplete form! < /h1> ';
    return;
}



/*print_r($_GET);*/


$id = $_GET['id'];
$cookie = $_GET['cookie'];
$count = $_GET['count'];


while($count>0){
   
    $stData = json_decode( getSt($cookie),true);
    if($stData['data']['login']=='true'){
        $st = $stData['data']['st'];
        echo 'Landing successfully < br> ';
    }else{
        echo 'Landing failed:'.json_encode ($stData).'<br>';
        break;
    }
    ob_flush(); //Output buffer
    flush(); 

    $result = json_decode(resport($id,$st,$cookie),true) ;

    if($result['ok']!='1'){
        echo  'Operation failed:'.json_encode ($result).'<br>';
        echo 'The program is suspended for half an hour before opening < br> ';
        ob_flush(); //Output buffer
        flush(); 
        //If you fail, rest for half an hour.
        sleep(60*10);
    }else{
        echo 'Successful < br> ';
        ob_flush(); //Output buffer
        flush();         
    }

    $count--;
    sleep(30);
}



function getWord(){
    $data = ['[Love you,'[Bye],'[Embrace],'[Sorrow],'[Not Easy],'[Despise],'[Shut up],'[Gluttony],'[Melon],'[Surprise],'[Yawn],'[Face],'[Top],'[Difficult],'[Feeling], etc.Fall,'[kneel],'[applause],'[haha],'[shy],'[sweat],'[smile],'[laugh but not speak],'[black line],'[hum],'[bad laugh],'[color],'[squeeze eyes],'[lovely],'[pity] ''[Cool],'[Skull],'[Sleep],'[Tears],'[Anger],'[Scolding],'[Money],'[Kinship],'[Silly Eye],'[Illness],'[Disappointment],'[Decline],'[Sleep],'[Thinking], '[Too happy]','[show your hands],'[lick your screen],'[snicker],'[vomit],'[pick your nose],'[wronged],'[dirty],'[laugh cry],'[longing],'[hip-hop],'[shush],'[mutual powder],'[crazy],'[permit]Sad, 'halo', 'right hum', '[doubt],' [insidious] ',' [Altman] '.];

    return $data[rand(0,count($data)-1)].$data[rand(0,count($data)-1)].$data[rand(0,count($data)-1)].$data[rand(0,count($data)-1)].$data[rand(0,count($data)-1)];
}

//Forward
function resport($id,$st,$cookie){
    $url = 'https://m.weibo.cn/api/statuses/repost';
    $referer = 'https://m.weibo.cn/compose/repost?id='.$id;
    $data = [
        'id'=>$id,
        'content'=>getWord(),
        'visible'=>'1',
        'mid'=>$id,
        'st'=>$st
    ];
    return _grab($url,$data,$cookie,$referer);
}



//Get st (post forwarding must)
function getSt($cookie){
    $configUrl = 'https://m.weibo.cn/api/config';
    $result = _grab($configUrl,'',$cookie); 
    return  $result;
}

//Reptilian
function _grab($curl,$postInfo='',$cookie='',$referer=''){
     $ch = curl_init();  
     curl_setopt($ch, CURLOPT_URL, $curl);  
     //Never lose the head
     curl_setopt($ch, CURLOPT_HEADER, 0);   
     //Returns the information obtained by string, not directly output.
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

     //If it is a HTTPS link, the certificate is not verified.
     if(substr_count($curl,'https')){
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     }
     //POST
     if($postInfo){
        curl_setopt($ch,CURLOPT_POST,1);
        curl_setopt($ch,CURLOPT_POSTFIELDS,$postInfo);
     }
     //Join cookie
     if($cookie){
         curl_setopt($ch,CURLOPT_COOKIE,$cookie);
     }
     //Analogue circuit
     if($referer){
        curl_setopt($ch, CURLOPT_REFERER, $referer);
     }
    
       //Simulation browser
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36');

     //implement
     $content = curl_exec($ch);  
     //error handling
     if ($content  === false) {  
       return "Network request error: "curl_error.$ch);  
       exit();  
     }  
     return $content;
}

?>

 

Leave a Reply

Your email address will not be published. Required fields are marked *