QQ名片赞点赞接口,PHP文件

自己根据API开发吧!

<?php
error_reporting(0);
header('content-type:application/json');
date_default_timezone_set("PRC");
$data=$_POST;
$qq=$data['qq'];
$uin=$data['uin']; 
$skey=$data['skey'];
$pskey=$data['pskey'];
$count=isset($data['count'])?$data['count']:0;
$gtk=gtk($pskey);

if(!$qq || !$uin || !$skey || !$pskey)exit('error');

$cookie = 'pt2gguin=o0' . $uin . '; uin=o0' . $uin . '; skey=' . $skey . '; p_uin=o0' . $uin.'; p_skey='.$pskey.';';
for($i=0; $i<=$count; $i++){
$url='https://club.vip.qq.com/visitor/like?g_tk='.$gtk.'&nav=0&uin='.$qq.'&t='.times();
$json=get_curl($url,0,'https://club.vip.qq.com/visitor/index?_wv=4099&_nav_bgclr=ffffff&_nav_titleclr=ffffff&_nav_txtclr=ffffff&_nav_alpha=0',$cookie);
}
$arr=json_decode($json,true);
if($arr['retcode']==20003){
$json ='点赞上限';
}elseif($arr['retcode']==10003){
$json ='权限异常';
}elseif($arr['code']=="-400"){
$json ='登录失效';
}elseif($arr['retcode']==0){
$json ='点赞成功';
}else{
$json ='点赞失败';
}

//$fp = fopen("./cookie.log","a+");  
//fwrite($fp,$cookie."\r");  
//fclose($fp); 

exit($json);

function times() {
    list($t1, $t2) = explode(' ', microtime());
    return (float)sprintf('%.0f',(floatval($t1)+floatval($t2))*1000);
}
function GTK($skey){
    $len = strlen($skey);
    $hash = 5381;
    for ($i = 0; $i < $len; $i++) {
        $hash += ($hash << 5 & 2147483647) + ord($skey[$i]) & 2147483647;
        $hash &= 2147483647;
    }
    return $hash & 2147483647;
}
function get_curl($url,$post=0,$referer=0,$cookie=0,$header=0,$ua=0,$nobaody=0,$split=0){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $httpheader[] = "Accept:*/*";
        $httpheader[] = "Accept-Encoding:gzip,deflate,sdch";
        $httpheader[] = "Accept-Language:zh-CN,zh;q=0.8";
        $httpheader[] = "Connection:close";
        curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
        if($post){
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }
        if($header){
            curl_setopt($ch, CURLOPT_HEADER, TRUE);
        }
        if($cookie){
            curl_setopt($ch, CURLOPT_COOKIE, $cookie);
        }
        if($referer){
            curl_setopt($ch, CURLOPT_REFERER, $referer);
        }
        if($ua){
            curl_setopt($ch, CURLOPT_USERAGENT,$ua);
        }else{
            curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36');
        }
        if($nobaody){
            curl_setopt($ch, CURLOPT_NOBODY,1);

        }
        curl_setopt($ch, CURLOPT_ENCODING, "gzip");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
        $ret = curl_exec($ch);
        if ($split) {
            $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
            $header = substr($ret, 0, $headerSize);
            $body = substr($ret, $headerSize);
            $ret=array();
            $ret['header']=$header;
            $ret['body']=$body;
        }
        curl_close($ch);
        return $ret;
    }