Exemplo n.º 1
0
function wmzz_zan_do($kw, $pid, $tid, $b)
{
    $pda = array('BDUSS' => $b, '_client_id' => 'wappc_1396611108603_817', '_client_type' => '2', '_client_version' => '5.7.0', '_phone_imei' => '642b43b58d21b7a5814e1fd41b08e2a6', 'action' => 'like', 'from' => 'tieba', 'kw' => $kw, 'post_id' => $pid, 'thread_id' => $tid);
    $ex = '';
    foreach ($pda as $k => $v) {
        $ex .= $k . '=' . $v;
    }
    $pda['sign'] = md5($ex . 'tiebaclient!!!');
    //!!
    $x = new wcurl('http://c.tieba.baidu.com/c/c/zan/like', array('Content-Type: application/x-www-form-urlencoded'));
    $x->addcookie('BDUSS=' . $b);
    $x->set(CURLOPT_TIMEOUT, 1);
    return $x->post($pda);
    //$x->close();
}
 /**
  * 登录百度
  * @param 百度用户名
  * @param 百度密码
  * @param 验证码
  * @param $vcodestr
  * @return 登录完成的页面
  */
 public static function loginBaidu($bd_name, $bd_pw, $verifycode, $vcodestr)
 {
     $x = new wcurl('http://wappass.baidu.com/passport/?verifycode=' . $verifycode, array('User-Agent: Phone' . mt_rand()));
     $x->set(CURLOPT_HEADER, true);
     return $x->post(array('username' => $bd_name, 'password' => $bd_pw, 'verifycode' => $verifycode, 'login_save' => '3', 'vcodestr' => $vcodestr, 'aaa' => '%E7%99%BB%E5%BD%95', 'login' => 'yes', 'can_input' => '0', 'u' => 'http%3A%2F%2Fm.baidu.com%2F%3Faction%3Dlogin', 'tn', 'tpl', 'ssid' => '000000', 'form' => '0', 'bd_page_type' => '1', 'uid' => 'wiaui_1316933575_9548', 'isPhone' => 'isPhone'));
 }
Exemplo n.º 3
0
/**
 * 执行一个网络请求而不等待返回结果
 * @param string $url URL
 * @param string $post post数据包,留空为get
 * @param string $cookie cookies
 * @return bool fsockopen是否成功
 */
function sendRequest($url, $post = '', $cookie = '')
{
    if (function_exists('fsockopen')) {
        $matches = parse_url($url);
        $host = $matches['host'];
        if (substr($url, 0, 8) == 'https://') {
            $host = 'ssl://' . $host;
        }
        $path = $matches['path'] ? $matches['path'] . ($matches['query'] ? '?' . $matches['query'] : '') : '/';
        $port = !empty($matches['port']) ? $matches['port'] : 80;
        if (!empty($post)) {
            $out = "POST {$path} HTTP/1.1\r\n";
            $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
            $out .= "Host: {$host}\r\n";
            $out .= "Connection: Close\r\n\r\n";
            $out .= $post;
        } else {
            $out = "GET {$path} HTTP/1.1\r\n";
            $out .= "Host: {$host}\r\n";
            $out .= "Connection: Close\r\n\r\n";
        }
        $fp = fsockopen($host, $port);
        if (!$fp) {
            return false;
        } else {
            stream_set_blocking($fp, 0);
            stream_set_timeout($fp, 0);
            fwrite($fp, $out);
            fclose($fp);
            return true;
        }
    } else {
        $x = new wcurl($url);
        $x->set(CURLOPT_CONNECTTIMEOUT, 1);
        $x->set(CURLOPT_TIMEOUT, 1);
        $x->addcookie($cookie);
        if (empty($post)) {
            $x->post($post);
        } else {
            $x->exec();
        }
        return true;
    }
}
Exemplo n.º 4
0
 public static function getTieba($userid, $bduss, $pn)
 {
     $head = array();
     $head[] = 'Content-Type: application/x-www-form-urlencoded';
     $head[] = 'User-Agent: Mozilla/5.0 (SymbianOS/9.3; Series60/3.2 NokiaE72-1/021.021; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.1.16352';
     $tl = new wcurl('http://c.tieba.baidu.com/c/f/forum/like', $head);
     $data = array('_client_id' => 'wappc_' . time() . '_' . '258', '_client_type' => 2, '_client_version' => '6.5.8', '_phone_imei' => '357143042411618', 'from' => 'baidu_appstore', 'is_guest' => 1, 'model' => 'H60-L01', 'page_no' => $pn, 'page_size' => 200, 'timestamp' => time() . '903', 'uid' => $userid);
     $sign_str = '';
     foreach ($data as $k => $v) {
         $sign_str .= $k . '=' . $v;
     }
     $sign = strtoupper(md5($sign_str . 'tiebaclient!!!'));
     $data['sign'] = $sign;
     $tl->addCookie(array('BDUSS' => $bduss));
     $tl->set(CURLOPT_RETURNTRANSFER, true);
     $rt = $tl->post($data);
     return $rt;
 }