weixin oauth api 使用

<?php
Session_start();

/*
 * 微信端限制
 */

$local_url=‘http://‘.$_SERVER[‘SERVER_NAME‘].‘:‘.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
$user_agent = $_SERVER [‘HTTP_USER_AGENT‘];
if (strpos ( $user_agent, ‘MicroMessenger‘ ) === false) {
    echo "<h4>请用微信扫一扫二维码打开</h4>";
    echo "<img src=‘http://qr.liantu.com/api.php?text={$local_url}‘/>";
    exit();
}else{
    if($_GET[‘openid‘]){
        $_SESSION[‘openid‘]=$_GET[‘openid‘];
        unset($_GET[‘openid‘]);
        foreach ($_GET as $k=> $v) {
            $get_url.="&".$k."=".$v;
        }
        $real_url="http://{$_SERVER [‘HTTP_HOST‘]}{$_SERVER[‘PHP_SELF‘]}?a=1".urlencode($get_url);
        header ( "Location:" . $real_url );
    }else{
        if(!$_SESSION[‘openid‘]){
            $local_urls=urlencode($local_url);
            $sit_oauth2="http://api.4vtk.com/oauth2.php?back_url=".$local_urls;
            header ( "Location:" . $sit_oauth2 );
        }

    }
}

?>
时间: 2024-07-30 13:46:42

weixin oauth api 使用的相关文章

weixin oauth 授权

1. 先了解下请求授权页面的构造方式: https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect state 是自定义的 参数 必须 说明 appid 是 公众号的唯一标识 redirect_uri 是 授权后重定向的回调链接地址 res

新浪微博Oauth API调用方法

// //  OauthViewController.m //  WPWEIBO // //  Created by apple on 15/5/12. //  Copyright (c) 2015年 apple. All rights reserved. // #import "OauthViewController.h" @interface OauthViewController () <UIWebViewDelegate,NSURLConnectionDataDelega

Docker入门教程(七)Docker API

Docker入门教程(七)Docker API [编者的话]DockerOne组织翻译了Flux7的Docker入门教程,本文是系列入门教程的第七篇,重点介绍了Docker Registry API和Docker Hub API. 纵观我们的Docker系列教程,我们已经讨论了很多重要的Docker组件与命令.在本文中,我们将继续深入学习Docker:剖析Docker APIs. Docker提供了很多的API以便用户使用.这些API包含四个方面: Docker Registry API Doc

新浪微博API Oauth2.0 认证

原文链接: http://rsj217.diandian.com/post/2013-04-17/40050093587 本意是在注销账号前保留之前的一些数据.决定用python 爬取收藏.可是未登录无法爬取.想要登录有两种办法,伪造浏览器登录.第二就是注册新浪开发者账号,通过Oauth认证调用其API. Oauth 的原理搞了一天才明白.很多网站都提供多语言的Oauth.而 1.0 和 2.0 的最大差别就是多了一个 callback 回调页面.关于这方面的说明很少,搞得我一头雾水折腾了好久.

Twitter OAuth

新浪微博和 Twitter 的 Oauth API 为什么感觉流程不一样 新浪: 开发者引导用户到新浪授权页面, 页面链接中需要带上自己的 apikey : 用户授权后新浪跳转到开发者指定指定的页面,并且附上服务器返回的一枚 code 作为 param : 开发者用这枚 code ,再加上自己的 apikey 和 api secret 去 post https://api.weibo.com/oauth2/access_token : post 返回 access_token; 以后开发者每次用

OAuth 流程与发展总结 (1.0 =&gt; 1.0a =&gt; 2.0)

OAuth 流程与发展 (1.0 => 1.0a => 2.0) 概述 概述: 开放授权协议 作用: 允许第三方应用访问服务提供方中注册的终端用户的部分资源 下面是官方描述: [OAuth描述] The OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource own

OAuth02.接入github oauth app

接入github OAuth时序图 github oauth api地址 https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/ 1. 使用client_id scope等获取code.  浏览器输入: https://github.com/login/oauth/authorize?client_id=Iv1.3531c407ca366ce0&scope=user,repo 获得redire u

我是企业号体验账户 我发送消息:微信错误 errcode=60011,

http://qydev.weixin.qq.com/qa/index.php?qa=3197&qa_1=%E6%88%91%E6%98%AF%E4%BC%81%E4%B8%9A%E5%8F%B7%E4%BD%93%E9%AA%8C%E8%B4%A6%E6%88%B7-%E6%88%91%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF%EF%BC%9A%E5%BE%AE%E4%BF%A1%E9%94%99%E8%AF%AF&show=3197#q3197 我是企业号

apiCloud通过ajax获取数据

<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/> <meta name="