腾讯微博API接口的问题
程序员文章站
2022-05-02 13:57:45
...
从数据库里读取openid和openkey,然后发图文的腾讯微博(其他网站图片),我按照demo.php写了一段简单的程序,但是运行的时候总报错
{"data":null,"detailerrinfo":{"accesstoken":"","apiname":"weibo.t.add_pic_url","appkey":"801340003","clientip":"222.73.219.176","cmd":0,"proctime":0,"ret1":3,"ret2":3,"ret3":34,"ret4":3743515914,"timestamp":1365576080},"errcode":34,"msg":"check sign error","ret":3,"seqid":1365576082}
我把demo.php直接扔到测试地址还是报这个错。。。。哪位大神知道为什么?
代码我只是把这个内容改了,其他地方没动,
$params = array(
'content' => '以链接形式发表一条图片微博',
'pic_url' => 'http://test.**.com/29/32/1365575279819.jpg'
);
$r = Tencent::api('t/add_pic_url', $params, 'POST');
echo $r;
{"data":null,"detailerrinfo":{"accesstoken":"","apiname":"weibo.t.add_pic_url","appkey":"801340003","clientip":"222.73.219.176","cmd":0,"proctime":0,"ret1":3,"ret2":3,"ret3":34,"ret4":3743515914,"timestamp":1365576080},"errcode":34,"msg":"check sign error","ret":3,"seqid":1365576082}
我把demo.php直接扔到测试地址还是报这个错。。。。哪位大神知道为什么?
代码我只是把这个内容改了,其他地方没动,
$params = array(
'content' => '以链接形式发表一条图片微博',
'pic_url' => 'http://test.**.com/29/32/1365575279819.jpg'
);
$r = Tencent::api('t/add_pic_url', $params, 'POST');
echo $r;
回复讨论(解决方案)
使用接口之前,是先要验证的,就是在实例化时要传入openid和$access_token这2个值
即$qq = new QC($access_token,$openid);
这2个值是在会员登录时获取到的,这2个值在会员登录时你可以保存到数据库去,需要的时候再读取出来就是了
我知道怎么回事了,是我调用的路径有问题
上一篇: post-【还未解决,再求助】求php远程抓取的代码!
下一篇: PHP移动目录自定义函数