function twitteroauth_row($method, $response, $http_code, $parameters = '')
{
    echo "<br/>****************************************<br/>\r\n";
    $response = array_reverse($response);
    foreach ($response as $key => $value) {
        print_r($key);
        echo "=>";
        $fp = fopen("/var/www/html/tw/param_test.txt", "r");
        $lastid = fgets($fp);
        fclose($fp);
        $thisid = $value->{'id_str'};
        echo "thisid:" . $thisid . "   lastid:" . $lastid . "<br/>\n";
        if (strcasecmp($thisid, $lastid) <= 0) {
            echo "same<br/>\n";
            echo "<br/>***************************<br/>\r\n";
            continue;
        }
        $fp = fopen("/var/www/html/tw/param_test.txt", "w");
        if (fwrite($fp, $thisid) === false) {
            echo "write file failed<br/>\n";
        }
        fclose($fp);
        echo "<br/>\n";
        $text = $value->{'text'};
        $post = preg_replace("/#\\S*/", "\$0#", $text);
        echo $post . "_____with link<br/>\n";
        $post = getRedirectText($post);
        echo $post . "_____with redirectlink<br/>\n";
        $token = "2.00uj9JACuwl1VD699af49a280tL7qt";
        weibo_post($token, $post);
        sleep(2);
        echo "<br/>*********************<br/>";
    }
}
Example #2
0
function twitteroauth_row($method, $response, $http_code, $parameters = '')
{
    echo '<tr>';
    // print_r($response);
    echo "<br/>****************************************<br/>";
    $response = array_reverse($response);
    foreach ($response as $key => $value) {
        print_r($key);
        echo "=>";
        // print_r($value);
        echo "<br/>";
        echo "<br/>***************************<br/>";
        $thisid = $value->{'id_str'};
        static $lastid = "436791321211449344";
        echo "thisid:" . $thisid . "   lastid:" . $lastid;
        if (strcasecmp($thisid, $lastid) <= 0) {
            echo "same";
            continue;
        }
        $lastid = $thisid;
        echo "<br/>";
        $text = $value->{'text'};
        $post = preg_replace("/#\\S*/", "\$0#", $text);
        echo $post . "_____with link<br/>";
        $token = "2.00uj9JACuwl1VD699af49a280tL7qt";
        //$post = "lsjfoijfewoifjewofj http://www.bloomberg.com/news/2014.html";
        weibo_post($token, urlencode($post));
        // weibo_post($token,$post);
        // echo "<br/>*********************<br/>";
        //echo "<br/>*********************<br/>";
        echo "<br/>*********************<br/>";
        sleep(1);
    }
}