Using the PHP PEAR Services_Twitter Package with HTTPS

I have a PHP script that runs every few minutes via a cron job that has been running for a few years to send me direct messages on Twitter from a single-purpose Twitter account. The net result is that I can have system alerts sent to me by text message (by having direct messages from this special account subscribed for mobile alerts).

This script stopped working a week or two ago, and I finally got around to figuring out why. On Jan. 14, 2014, Twitter made SSL/TLS mandatory for connections to api.twitter.com. The announcement / blog post about that is here: https://dev.twitter.com/discussions/24239

Apparently, and not surprisingly, the PEAR module, Services_Twitter (available here: http://pear.php.net/package/Services_Twitter/),  works with api.twitter.com, and thus stopped working.

The fix was simple, once I was able to decipher the automated docs…

After this line: $twitter = new Services_Twitter();

I added this line: $twitter->setOption(‘use_ssl’,true);

The placement is probably flexible. But this one line worked. And my phone is now getting all those text message alerts that I dread. Yipee (?)

I wonder if I’m the only person using this library, considering that my Google searches came up surprisingly sparse on this topic…

 

 

Tags: , , , , , , , ,

3 Responses to “Using the PHP PEAR Services_Twitter Package with HTTPS”

  1. Choosing Accounting Software Says:

    Choosing Accounting Software

    Using the PHP PEAR Services_Twitter Package with HTTPS « The Perceptus Back Story

  2. รับสกรีนเสื้อยืด Says:

    รับสกรีนเสื้อยืด

    Using the PHP PEAR Services_Twitter Package with HTTPS « The Perceptus Back Story

  3. jiu jitsu portimao Says:

    jiu jitsu portimao

    Using the PHP PEAR Services_Twitter Package with HTTPS « The Perceptus Back Story

Leave a Reply