Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

TweetWX script updated for Twitter API V1.1

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
saratogaWX
Posts: 1202
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

TweetWX script updated for Twitter API V1.1

Post by saratogaWX »

Got to love the Twitter developers .. they turned off the API V1.0 on 11-June-2013 and forced everyone to use the API V1.1 instead.

Sigh.. I've done an update to TweetWX-globals.php that should fix your issues (no customization needed). The changes are to use HTTPS/SSL instead of HTTP for posting the status (and a new destination URL).

Let me know how it works for you :)

Best regards,
Ken
You do not have the required permissions to view the files attached to this post.
User avatar
saratogaWX
Posts: 1202
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: TweetWX script updated for Twitter API V1.1

Post by saratogaWX »

For those who would prefer to update their code in-place, the following changes were made to TweetWX-global.php (also applies to Mike's TweetWX642-global.php script):

Change:

Code: Select all

function do_post($url, $postbody, $port=80, $headers=NULL)
{
  $retarr = array();  // Return value

  $curl_opts = array(CURLOPT_URL => $url,
                     CURLOPT_PORT => $port,
                     CURLOPT_POST => true,
                     CURLOPT_SSL_VERIFYHOST => false,
                     CURLOPT_SSL_VERIFYPEER => false,
                     CURLOPT_POSTFIELDS => $postbody,
                     CURLOPT_RETURNTRANSFER => true);
To:

Code: Select all

function do_post($url, $postbody, $port=443, $headers=NULL)
{
  $retarr = array();  // Return value

  $curl_opts = array(CURLOPT_URL => $url,
                     CURLOPT_PORT => $port,
                     CURLOPT_POST => true,
                     CURLOPT_SSL_VERIFYHOST => true,
                     CURLOPT_SSL_VERIFYPEER => true,
                     CURLOPT_POSTFIELDS => $postbody,
                     CURLOPT_RETURNTRANSFER => true);
Change:

Code: Select all

  $url = 'http://api.twitter.com/1/statuses/update.json';
To:

Code: Select all

  $url = 'https://api.twitter.com/1.1/statuses/update.json';
Change:

Code: Select all

  if ($usePost) {
    $request_url = $url;
    logit("tweet:INFO:request_url:$request_url");
    logit("tweet:INFO:post_body:$query_parameter_string");
    $headers[] = 'Content-Type: application/x-www-form-urlencoded';
    $response = do_post($request_url, $query_parameter_string, 80, $headers);
  } else {
To:

Code: Select all

  if ($usePost) {
    $request_url = $url;
    logit("tweet:INFO:request_url:$request_url");
    logit("tweet:INFO:post_body:$query_parameter_string");
    $headers[] = 'Content-Type: application/x-www-form-urlencoded';
    $response = do_post($request_url, $query_parameter_string, 443, $headers);
  } else {
And your feed should work again.

Best regards,
Ken
josecmorales
Posts: 19
Joined: Thu 04 Jul 2013 4:13 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows 7
Location: Ciudad Guayana, Venezuela

Re: TweetWX script updated for Twitter API V1.1

Post by josecmorales »

This php works for the templates with cumulus data?
User avatar
saratogaWX
Posts: 1202
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: TweetWX script updated for Twitter API V1.1

Post by saratogaWX »

At present, the TweetWX PHP scripts (for conditions and forecast) work only with Weather-Display for conditions and with the USA NOAA forecasts for the forecast tweets. I'm working on generalizing the scripts to work with any software supported by the template set and forecasts from Environment Canada and WeatherUnderground, but the scripts are not yet finished.

Best regards,
Ken
josecmorales
Posts: 19
Joined: Thu 04 Jul 2013 4:13 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows 7
Location: Ciudad Guayana, Venezuela

Re: TweetWX script updated for Twitter API V1.1

Post by josecmorales »

thank you very much Ken, I look forward for that script
User avatar
saratogaWX
Posts: 1202
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: TweetWX script updated for Twitter API V1.1

Post by saratogaWX »

TweetWX scripts no longer function after 12:00 13-Jun-2023 Pacific. Twitter has suspended the application ID for TweetWX for 'rules violations' (likely over 1500 tweets per month with all the instances sharing the same app ID).
Sigh.. I've now deprecated the scripts and suggest you take them off your cron executions.
User avatar
ConligWX
Posts: 1633
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 24.04 LTS
Location: Bangor, NI
Contact:

Re: TweetWX script updated for Twitter API V1.1

Post by ConligWX »

I'm also surprised that the Twitter module in my Meteobridge Nano is still working!!
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir • CumulusMX v4.0.0

Image
Post Reply