October 13th, 2009

基于PHP的Google Voice 短信API

  Google Voice并没有提供官方API接口,但是实际上还是可以通过HTTP和XML请求的手段来实现。目前网上能够找到的API最终大都是溯源到Chad Smith的这篇主题帖

  要通过Google Voice实现发送短信,首先要登录到Google Voice账号,然后取出页面中的“_rnr_se”参数,最后把这个参数和对方手机号、短信内容POST到Google Voice SMS的地址即可。Tyler Hall曾经写过一个Google Voice的php类,但是我试用时并不成功,总是卡在登录Google Voice的过程上。对此我二次开发了它的这个类,重写了绝大部分代码。

  经过实际尝试,我没有使用Chad Smith的XML请求地址,而是使用了移动终端版的Google Voice请求地址并且根据需要改动了POST请求的参数,最终搞定了一个基于php的Google Voice短信发送工具,调用地址在http://www.lostleon.com/tools/googlevoice/,项目地址在http://phpgooglevoice.googlecode.com/

  很遗憾,我的天翼189号码不被Google Voice支持。移动158号码测试通过。

Related Posts:

Tags: , , , , ,

  1. ustor
    October 14th, 2009 at 14:07 | #1

    包子现在研究这啊,牛啊
    现在google voice我的bb怎么装不了啊

  2. ustor
    October 14th, 2009 at 14:13 | #2

    bb8700不支持……晕

  3. October 14th, 2009 at 19:53 | #3

    业余兴趣,呵呵

  4. October 14th, 2009 at 19:54 | #4

    不支持指的是bb8700上没有GV软件,还是说通过web也不能使用?如果是后者,试着改改浏览器的user-agent能行吗?

  5. 小石头
    October 16th, 2009 at 11:36 | #5

    小白问一句,请问这和直接进入voice网页发短信有什么区别?

  6. ustor
    October 16th, 2009 at 14:07 | #6

    应该是这个把访问代理什么的都加入了吧,直接在国内就可以使用?

  7. October 19th, 2009 at 12:27 | #7

    @小石头 这样可以一次性提交账号和短信内容。也就是做了一个接口相当于,方便直接调用

  8. October 19th, 2009 at 12:29 | #8

    @ustor 没有加入代理。只是注册的时候会限制在美国ip内,注册成功之后使用中没有ip限制

  9. December 19th, 2009 at 00:40 | #9

    十分感谢。非常有用。

    我结合cron jobs做了一个自动发短信的工具。

  10. December 20th, 2009 at 21:50 | #10

    Google Voice发短信要钱的吧,现在不要钱只是因为它里面有一定余额,发完了就没了。

  11. December 20th, 2009 at 21:51 | #11

    用飞信吧,写个api来玩玩。

  12. December 20th, 2009 at 21:58 | #12

    @zhang GV的国际短信是免费的。只是有限制(只支持英文、对中国某些号段不支持)
    以前用libfetion实现了个接口来,现在改换电信的手机了,悲剧的我木有飞信鸟。。

  13. John
    December 29th, 2009 at 05:09 | #13

    Hello, Can You please give me this script http://www.lostleon.com/tools/googlevoice/

    I am waiting for kind reply

    Besh Wishes.

  14. December 29th, 2009 at 09:56 | #14

    @John You could download the API at http://code.google.com/p/phpgooglevoice/

  15. May 4th, 2010 at 23:18 | #15

    为什么在http://code.google.com/p/phpgooglevoice/ 下的提示Moved Temporarily而你的就可以用呢

  16. May 5th, 2010 at 13:48 | #16

    @phper 多人跟我反映了,目前认为是GV调整了IP策略,在美国IP上测试就没有问题。

  17. May 19th, 2010 at 17:31 | #17

    我试过了,应该不是IP策略

    1、我用翻墙测试,还是提示Moved Temporarily,应该是提交的地址GOOGLE调整了。

    2、直接登陆GOOGLE VOICE可以发出信息,那应该就没有限制IP的。

  18. fred
    May 26th, 2010 at 06:33 | #18

    code has stopped working after google did some updates

  19. May 28th, 2010 at 11:11 | #19

    @紫岩 @fred
    i update my php-google-voice class today
    check it here http://code.google.com/p/phpgooglevoice/

  20. January 25th, 2012 at 22:48 | #20

    现在还好用马

  1. No trackbacks yet.