Skip to content

Instantly share code, notes, and snippets.

@davidkryzaniak
Last active August 29, 2015 14:28
Show Gist options
  • Select an option

  • Save davidkryzaniak/c54bc9fc5b05ad7eefe3 to your computer and use it in GitHub Desktop.

Select an option

Save davidkryzaniak/c54bc9fc5b05ad7eefe3 to your computer and use it in GitHub Desktop.

Revisions

  1. davidkryzaniak revised this gist Aug 23, 2015. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions dash-send-tweet-endpoint.php
    Original file line number Diff line number Diff line change
    @@ -10,24 +10,24 @@

    // Load Composer
    require_once('../vendor/autoload.php');

    //if the type is set to "twitter" and the msg is not empty
    if(isset($_GET['type']) && "twitter" == $_GET['type'] && isset($_GET['msg']) && !empty($_GET['msg'])){

    //prepend a timestamp to the message
    $message = '['.date('Y-m-d H:i:s').'] '.urldecode($_GET['msg']);

    // Using dg's twitter library - https://github.com/dg/twitter-php
    // Using dg's twitter library - https://github.com/dg/twitter-php
    $twitter = new Twitter(
    'ConsumerKey',
    'ConsumerSecret',
    'AccessToken',
    'AccessTokenSecret'
    'ConsumerKey',
    'ConsumerSecret',
    'AccessToken',
    'AccessTokenSecret'
    );

    //post it to Twitter
    $twitter->send($message);

    }

    }
  2. davidkryzaniak revised this gist Aug 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dash-send-tweet-endpoint.php
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@
    //prepend a timestamp to the message
    $message = '['.date('Y-m-d H:i:s').'] '.urldecode($_GET['msg']);

    // Using dg's twitter library - https://github.com/dg/twitter-php
    // Using dg's twitter library - https://github.com/dg/twitter-php
    $twitter = new Twitter(
    'ConsumerKey',
    'ConsumerSecret',
  3. davidkryzaniak revised this gist Aug 23, 2015. No changes.
  4. davidkryzaniak revised this gist Aug 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dash-send-tweet-endpoint.php
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@
    require_once('../vendor/autoload.php');

    //if the type is set to "twitter" and the msg is not empty
    if("twitter" == isset($_GET['type']) && $_GET['type'] && isset($_GET['msg']) && !empty($_GET['msg'])){
    if(isset($_GET['type']) && "twitter" == $_GET['type'] && isset($_GET['msg']) && !empty($_GET['msg'])){

    //prepend a timestamp to the message
    $message = '['.date('Y-m-d H:i:s').'] '.urldecode($_GET['msg']);
  5. davidkryzaniak created this gist Aug 23, 2015.
    33 changes: 33 additions & 0 deletions dash-send-tweet-endpoint.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    <?php

    error_reporting(E_ALL);
    ini_set('display_errors', 1);

    $ua = $_SERVER['HTTP_USER_AGENT'];

    //User agent must be set to "**MY-SECRET-USER-AGENT**" and the ?secret must be "key"
    if("**MY-SECRET-USER-AGENT**" == $ua && isset($_GET['secret']) && "key" == $_GET['secret']){

    // Load Composer
    require_once('../vendor/autoload.php');

    //if the type is set to "twitter" and the msg is not empty
    if("twitter" == isset($_GET['type']) && $_GET['type'] && isset($_GET['msg']) && !empty($_GET['msg'])){

    //prepend a timestamp to the message
    $message = '['.date('Y-m-d H:i:s').'] '.urldecode($_GET['msg']);

    // Using dg's twitter library - https://github.com/dg/twitter-php
    $twitter = new Twitter(
    'ConsumerKey',
    'ConsumerSecret',
    'AccessToken',
    'AccessTokenSecret'
    );

    //post it to Twitter
    $twitter->send($message);

    }

    }