最新动态
QQ、新浪微博、腾讯微博、人人网、开心网、豆瓣登录接口整合
2024-11-07 12:43
<?php

QQ、新浪微博、腾讯微博、人人网、开心网、豆瓣登录接口整合

class tqqPHP { function __construct($client_id, $client_secret, $access_token=NULL, $openid=NULL){ $this->client_id=$client_id; $this->client_secret=$client_secret; $this->access_token=$access_token; $this->openid=$openid; function login_url($callback_url){ 'response_type'=>'code', return 'https://open.t.qq.com/cgi-bin/oauth2/authorize?'.http_build_query($params); function access_token($callback_url, $code){ 'grant_type'=>'authorization_code', 'code'=>$code, 'client_secret'=>$this->client_secret, function access_token_refresh($refresh_token){ 'grant_type'=>'refresh_token', 'refresh_token'=>$refresh_token, 'client_id'=>$this->client_id function me(){ $params=array(); $url='https://open.t.qq.com/api/user/info'; function getMyTweet($reqnum=10, $pageflag=0){ 'pageflag'=>$pageflag, 'reqnum'=>$reqnum $url='https://open.t.qq.com/api/statuses/broadcast_timeline'; function getRecount($ids){ 'ids'=>$ids, 'flag'=>2 $url='https://open.t.qq.com/api/t/re_count'; function getReplay($id, $flag=0, $f=0, $n=10){ 'rootid'=>$id, 'pageflag'=>$f, 'reqnum'=>$n, 'flag'=>$flag $url='https://open.t.qq.com/api/t/re_list'; function postOne($img_c, $pic=''){ 'content'=>$img_c if($pic!='' && is_array($pic)){ $url='https://open.t.qq.com/api/t/add_pic'; $params['pic']=$pic; $url='https://open.t.qq.com/api/t/add'; return $this->api($url, $params, 'POST'); function api($url, $params, $method='GET'){ $params['oauth_consumer_key']=$this->client_id; $params['access_token']=$this->access_token; $params['openid']=$this->openid; $params['clientip']=$this->getIP(); $params['oauth_version']='2.a'; $params['format']='json'; $params['scope']='all'; if($method=='GET'){ $result_str=$this->http($url.'?'.http_build_query($params)); if(isset($params['pic'])){ uksort($params, 'strcmp'); $str_b=uniqid('------------------'); $str_m='--'.$str_b; $str_e=$str_m. '--'; $body=''; foreach($params as $k=>$v){ if($k=='pic'){ if(is_array($v)){ $img_c=$v[2]; $img_n=$v[1]; }elseif($v{0}=='@'){ $url=ltrim($v, '@'); $img_c=file_get_contents($url); $url_a=explode('?', basename($url)); $img_n=$url_a[0]; $body.='Content-Disposition: form-data; name="'.$k.'"; filename="'.$img_n.'"'." $body.="Content-Type: image/unknown $body.=$img_c." $body.='Content-Disposition: form-data; name="'.$k.""    以上就是本篇文章【QQ、新浪微博、腾讯微博、人人网、开心网、豆瓣登录接口整合】的全部内容了,欢迎阅览 ! 文章地址:http://sicmodule.kub2b.com/quote/128.html 
     资讯      企业新闻      行情      企业黄页      同类资讯      首页      网站地图      返回首页 企库往资讯移动站 http://changmeillh.kub2b.com/ , 查看更多   
发表评论
0评