WeChat公衆プラットフォームAPIインターフェース拡張パッケージ
25463 ワード
転載先:http://www.thinkphp.cn/extend/295.html
wechat.class.phpは公式APIを呼び出し、APIの各機能を細分化し、チェーン呼び出しをサポートします.
wechatext.class.phpは非公式APIであり、アカウントとパスワードを設定する必要があり、能動的なポイント対マイクロメッセージとバッチ送信を実現することができます.この方式は長期的な有効性を保証しません.
Thinkphp環境ではORGディレクトリに入れて、importメソッドで呼び出すことができます.
もっと詳しい情報と更新はプロジェクトgithubアドレスにアクセスできます.forkを歓迎します.
https://github.com/dodgepudding/wechat-php-sdk
基本API呼び出し例:
wechat.class.phpは公式APIを呼び出し、APIの各機能を細分化し、チェーン呼び出しをサポートします.
wechatext.class.phpは非公式APIであり、アカウントとパスワードを設定する必要があり、能動的なポイント対マイクロメッセージとバッチ送信を実現することができます.この方式は長期的な有効性を保証しません.
Thinkphp環境ではORGディレクトリに入れて、importメソッドで呼び出すことができます.
もっと詳しい情報と更新はプロジェクトgithubアドレスにアクセスできます.forkを歓迎します.
https://github.com/dodgepudding/wechat-php-sdk
基本API呼び出し例:
- include "wechat.class.php"
- $options = array(
- 'token'=>'tokenaccesskey' // key
- );
- $weObj = new Wechat($options);
- $weObj->valid();
- $type = $weObj->getRev()->getRevType();
- switch($type) {
- case Wechat::MSGTYPE_TEXT:
- $weObj->text("hello, I'm wechat")->reply();
- exit;
- break;
- case Wechat::MSGTYPE_EVENT:
- break;
- case Wechat::MSGTYPE_IMAGE:
- break;
- default:
- $weObj->text("help info")->reply();
- }
:
- include("wechatext.class.php");
-
- function logdebug($text){
- file_put_contents('./data/log.txt',$text."
",FILE_APPEND);
- };
-
- $options = array(
- 'account'=>'[email protected]',
- 'password'=>'demo',
- 'datapath'=>'./data/cookie_',
- 'debug'=>true,
- 'logcallback'=>'logdebug'
- );
- $wechat = new Wechatext($options);
- if ($wechat->checkValid()) {
- //
- $data = $wechat->getInfo('3974200');
- //
- //$wechat->send('3974200','hello '.time());
- var_dump($data);
- }
1.1 :
Wechatext API( )
:
* send($id,$content) id
* batch($ids,$content)
* sendNews($account,$title,$summary,$content,$pic,$srcurl='')
Wechatauth API
: http://blog.4wer.com/wechat-php-sdk
:
* get_login_code() ,
* get_code_image($code='')
* verify_code() , 200 .
* get_login_cookie()
* sendNews($account,$title,$summary,$content,$pic,$srcurl='')